From 05e2bed4d211ea3f4b56b909c3d57f1aeedb5edf Mon Sep 17 00:00:00 2001 From: Valentin Weber <valentin@wv2.ch> Date: Sat, 7 Dec 2024 21:07:15 +0100 Subject: [PATCH 1/4] feat: refactor user settings part 1 --- templates/settings.html | 76 ++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/templates/settings.html b/templates/settings.html index 69713be..443396a 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -25,37 +25,57 @@ <h2>My Account</h2> <form id="settings-myaccount-form" method="post" action="/settings?change=account" accept-charset="UTF-8"> - <label class="form-label" for="settings-myaccount-username">Username: </label> - <input class="form-control" id="settings-myaccount-username" type="text" name="username" value="{{ authuser.name }}" /><br/> - - <label class="form-label" for="settings-myaccount-email">E-Mail: </label> - <input class="form-control" id="settings-myaccount-email" type="text" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}" /><br/> - - <label class="form-label" for="settings-myaccount-receipt-pref">Receipts: </label> - <select class="form-select" id="settings-myaccount-receipt-pref" name="receipt_pref"> - {% for pref in receipt_preference_class %} - <option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected="selected" {% endif %}>{{ pref.human_readable }}</option> - {% endfor %} - </select> - {% if config_smtp_enabled != '1' %}Sending receipts is disabled by your administrator.{% endif %} - <br/> - - <div class="form-check"> - <input class="form-check-input" id="settings-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}/> - <label class="form-check-label" for="settings-myaccount-ismember">Member</label> + <div class="row g-2"> + <div class="col-md"> + <div class="form-floating"> + <input class="form-control" id="settings-myaccount-username" type="text" name="username" value="{{ authuser.name }}"> + <label for="settings-myaccount-username">Username</label> + </div> + </div> + <div class="col-md"> + <div class="form-floating"> + <input class="form-control" id="settings-myaccount-email" type="email" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}"> + <label for="settings-myaccount-email">E-Mail</label> + </div> + </div> + {% if config_smtp_enabled == '1' %} + <div class="col-md"> + <div class="form-floating"> + <select class="form-select" id="settings-myaccount-receipt-pref" name="receipt_pref"> + {% for pref in receipt_preference_class %} + <option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected {% endif %}>{{ pref.human_readable }}</option> + {% endfor %} + </select> + <label for="settings-myaccount-receipt-pref">Receipts</label> + </div> + </div> + {% endif %} </div> - - <div class="form-check"> - <input class="form-check-input" id="settings-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}/> - <label class="form-check-label" for="settings-myaccount-isadmin">Admin</label> + <div class="row g-2"> + <div class="col"> + <div class="form-check"> + <input class="form-check-input" id="settings-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}> + <label class="form-check-label" for="settings-myaccount-ismember">Member</label> + </div> + </div> + <div class="col"> + <div class="form-check"> + <input class="form-check-input" id="settings-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}> + <label class="form-check-label" for="settings-myaccount-isadmin">Admin</label> + </div> + </div> + <div class="col"> + <div class="form-check"> + <input class="form-check-input" id="settings-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}> + <label class="form-check-label" for="settings-myaccount-logout-after-purchase">Logout after purchase</label> + </div> + </div> </div> - - <div class="form-check"> - <input class="form-check-input" id="settings-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}/> - <label class="form-check-label" for="settings-myaccount-logout-after-purchase">Logout after purchase</label> + <div class="row g-2"> + <div class="col"> + <input class="btn btn-primary" type="submit" value="Save changes"> + </div> </div> - - <input class="btn btn-primary" type="submit" value="Save changes" /> </form> <h2>Avatar</h2> From 9a1c22081330e2df354f50b0835b69a6921b32f3 Mon Sep 17 00:00:00 2001 From: Valentin Weber <valentin@wv2.ch> Date: Sat, 7 Dec 2024 21:07:15 +0100 Subject: [PATCH 2/4] feat: refactor user settings part 1 --- templates/settings.html | 76 ++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/templates/settings.html b/templates/settings.html index 69713be..443396a 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -25,37 +25,57 @@ <h2>My Account</h2> <form id="settings-myaccount-form" method="post" action="/settings?change=account" accept-charset="UTF-8"> - <label class="form-label" for="settings-myaccount-username">Username: </label> - <input class="form-control" id="settings-myaccount-username" type="text" name="username" value="{{ authuser.name }}" /><br/> - - <label class="form-label" for="settings-myaccount-email">E-Mail: </label> - <input class="form-control" id="settings-myaccount-email" type="text" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}" /><br/> - - <label class="form-label" for="settings-myaccount-receipt-pref">Receipts: </label> - <select class="form-select" id="settings-myaccount-receipt-pref" name="receipt_pref"> - {% for pref in receipt_preference_class %} - <option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected="selected" {% endif %}>{{ pref.human_readable }}</option> - {% endfor %} - </select> - {% if config_smtp_enabled != '1' %}Sending receipts is disabled by your administrator.{% endif %} - <br/> - - <div class="form-check"> - <input class="form-check-input" id="settings-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}/> - <label class="form-check-label" for="settings-myaccount-ismember">Member</label> + <div class="row g-2"> + <div class="col-md"> + <div class="form-floating"> + <input class="form-control" id="settings-myaccount-username" type="text" name="username" value="{{ authuser.name }}"> + <label for="settings-myaccount-username">Username</label> + </div> + </div> + <div class="col-md"> + <div class="form-floating"> + <input class="form-control" id="settings-myaccount-email" type="email" name="email" value="{% if authuser.email is not none %}{{ authuser.email }}{% endif %}"> + <label for="settings-myaccount-email">E-Mail</label> + </div> + </div> + {% if config_smtp_enabled == '1' %} + <div class="col-md"> + <div class="form-floating"> + <select class="form-select" id="settings-myaccount-receipt-pref" name="receipt_pref"> + {% for pref in receipt_preference_class %} + <option value="{{ pref.value }}" {% if authuser.receipt_pref == pref %} selected {% endif %}>{{ pref.human_readable }}</option> + {% endfor %} + </select> + <label for="settings-myaccount-receipt-pref">Receipts</label> + </div> + </div> + {% endif %} </div> - - <div class="form-check"> - <input class="form-check-input" id="settings-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}/> - <label class="form-check-label" for="settings-myaccount-isadmin">Admin</label> + <div class="row g-2"> + <div class="col"> + <div class="form-check"> + <input class="form-check-input" id="settings-myaccount-ismember" type="checkbox" disabled="disabled" {% if authuser.is_member %} checked="checked" {% endif %}> + <label class="form-check-label" for="settings-myaccount-ismember">Member</label> + </div> + </div> + <div class="col"> + <div class="form-check"> + <input class="form-check-input" id="settings-myaccount-isadmin" type="checkbox" disabled="disabled" {% if authuser.is_admin %} checked="checked" {% endif %}> + <label class="form-check-label" for="settings-myaccount-isadmin">Admin</label> + </div> + </div> + <div class="col"> + <div class="form-check"> + <input class="form-check-input" id="settings-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}> + <label class="form-check-label" for="settings-myaccount-logout-after-purchase">Logout after purchase</label> + </div> + </div> </div> - - <div class="form-check"> - <input class="form-check-input" id="settings-myaccount-logout-after-purchase" type="checkbox" name="logout_after_purchase" {% if authuser.logout_after_purchase %} checked="checked" {% endif %}/> - <label class="form-check-label" for="settings-myaccount-logout-after-purchase">Logout after purchase</label> + <div class="row g-2"> + <div class="col"> + <input class="btn btn-primary" type="submit" value="Save changes"> + </div> </div> - - <input class="btn btn-primary" type="submit" value="Save changes" /> </form> <h2>Avatar</h2> From d3c5a8a56b701492a0dbd9e680dcbdc0a58865e3 Mon Sep 17 00:00:00 2001 From: Valentin Weber <valentin@wv2.ch> Date: Sat, 7 Dec 2024 21:27:18 +0100 Subject: [PATCH 3/4] feat: move avatar up --- templates/settings.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/templates/settings.html b/templates/settings.html index 443396a..fed3e9f 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -24,6 +24,15 @@ <section class="tab-pane fade pt-3 show active" id="settings-account-tab-pane" role="tabpanel"> <h2>My Account</h2> + <div class="row itemlist"> + <div class="col-xl-1 col-md-2 col-sm-3 col-4 mb-3"> + <div class="card text-bg-light"> + <div class="card-header">{{ authuser.name }}</div> + <img class="card-img-bottom" draggable="false" src="/static/upload/thumbnails/users/{{ authuser.id }}.png?cacheBuster={{ now }}" alt="Avatar of {{ authuser.name }}"> + </div> + </div> + </div> + <form id="settings-myaccount-form" method="post" action="/settings?change=account" accept-charset="UTF-8"> <div class="row g-2"> <div class="col-md"> @@ -81,8 +90,6 @@ <h2>Avatar</h2> <form id="settings-avatar-form" method="post" action="/settings?change=avatar" enctype="multipart/form-data" accept-charset="UTF-8"> - <img src="/static/upload/thumbnails/users/{{ authuser.id }}.png?cacheBuster={{ now }}" alt="Avatar of {{ authuser.name }}" /><br/> - <label class="form-label" for="settings-avatar-avatar">Upload new file: </label> <input class="form-control" id="settings-avatar-avatar" type="file" name="avatar" accept="image/*" /><br/> From 470da688f3e0b655cc26a61dcdef5969a716c844 Mon Sep 17 00:00:00 2001 From: Valentin Weber <valentin@wv2.ch> Date: Sat, 7 Dec 2024 22:08:46 +0100 Subject: [PATCH 4/4] feat: refactor password change section --- templates/settings.html | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/templates/settings.html b/templates/settings.html index fed3e9f..8f7f719 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -101,16 +101,31 @@ <h2>Password</h2> <form id="settings-password-form" method="post" action="/settings?change=password" accept-charset="UTF-8"> - <label class="form-label" for="settings-password-oldpass">Current password: </label> - <input class="form-control" id="settings-password-oldpass" type="password" name="oldpass" /><br/> - - <label class="form-label" for="settings-password-newpass">New password: </label> - <input class="form-control" id="settings-password-newpass" type="password" name="newpass" /><br/> - - <label class="form-label" for="settings-password-newpass2">Repeat password: </label> - <input class="form-control" id="settings-password-newpass2" type="password" name="newpass2" /><br/> - - <input class="btn btn-primary" type="submit" value="Save changes" /> + <div class="row g-2 mb-2"> + <div class="col-md"> + <div class="form-floating"> + <input class="form-control" id="settings-password-oldpass" type="password" name="oldpass"> + <label for="settings-password-oldpass">Current password </label> + </div> + </div> + <div class="col-md"> + <div class="form-floating"> + <input class="form-control" id="settings-password-newpass" type="password" name="newpass"> + <label for="settings-password-newpass">New password</label> + </div> + </div> + <div class="col-md"> + <div class="form-floating"> + <input class="form-control" id="settings-password-newpass2" type="password" name="newpass2"> + <label for="settings-password-newpass2">Repeat password</label> + </div> + </div> + </div> + <div class="row g-2"> + <div class="col"> + <input class="btn btn-primary" type="submit" value="Save changes"> + </div> + </div> </form> </section>