From c3a2dc028db95530bf078aafc05270a110a556d1 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Fri, 14 Jun 2024 10:47:32 +0200 Subject: forms: use checkboxes for scope selection in UserForm Enable selection of multiple scopes in user/add and user/edit for restricted users. Replace quick form creation with an inline form definition in add_user.html and edit_user.html --- ogcp/templates/auth/add_user.html | 44 +++++++++++++++++++++++++++++++++---- ogcp/templates/auth/edit_user.html | 45 +++++++++++++++++++++++++++++++++----- 2 files changed, 80 insertions(+), 9 deletions(-) (limited to 'ogcp/templates/auth') diff --git a/ogcp/templates/auth/add_user.html b/ogcp/templates/auth/add_user.html index 91866fb..cc5ed09 100644 --- a/ogcp/templates/auth/add_user.html +++ b/ogcp/templates/auth/add_user.html @@ -9,9 +9,45 @@

{{_('Add a user')}}

-{{ wtf.quick_form(form, - action=url_for('user_add_post'), - method='post', - button_map={'submit_btn':'primary'}) }} +
+ {{ form.hidden_tag() }} + +
+ {{ form.username.label(class_='form-label') }} + {{ form.username(class_='form-control') }} +
+ +
+ {{ form.pwd.label(class_='form-label') }} + {{ form.pwd(class_='form-control') }} +
+ +
+ {{ form.pwd_confirm.label(class_='form-label') }} + {{ form.pwd_confirm(class_='form-control') }} +
+ +
+ {{ form.admin(class_='form-check-input') }} + {{ form.admin.label(class_='form-check-label') }} +
+ +
+ {{ form.scopes.label(class_='form-label') }} +
{{ form.scopes.description }}
+
+ {% for value, label, checked in form.scopes.iter_choices() %} +
+ + +
+ {% endfor %} +
+
+ +
+ {{ form.submit_btn(class_='btn btn-primary') }} +
+
{% endblock %} diff --git a/ogcp/templates/auth/edit_user.html b/ogcp/templates/auth/edit_user.html index 51437c9..b9e748d 100644 --- a/ogcp/templates/auth/edit_user.html +++ b/ogcp/templates/auth/edit_user.html @@ -9,10 +9,45 @@

{{_('Edit user {}').format(form.username.data)}}

-{{ wtf.quick_form(form, - action=url_for('user_edit_post'), - method='post', - button_map={'submit_btn':'primary'}, - id='user-form') }} +
+ {{ form.hidden_tag() }} + +
+ {{ form.username.label(class_='form-label') }} + {{ form.username(class_='form-control') }} +
+ +
+ {{ form.pwd.label(class_='form-label') }} + {{ form.pwd(class_='form-control') }} +
+ +
+ {{ form.pwd_confirm.label(class_='form-label') }} + {{ form.pwd_confirm(class_='form-control') }} +
+ +
+ {{ form.admin(class_='form-check-input') }} + {{ form.admin.label(class_='form-check-label') }} +
+ +
+ {{ form.scopes.label(class_='form-label') }} +
{{ form.scopes.description }}
+
+ {% for value, label, checked in form.scopes.iter_choices() %} +
+ + +
+ {% endfor %} +
+
+ +
+ {{ form.submit_btn(class_='btn btn-primary') }} +
+
{% endblock %} -- cgit v1.2.3-18-g5258