From 3407fb17ff027e1e2d005a684c6a7d640745eae0 Mon Sep 17 00:00:00 2001 From: Lukas Juhrich Date: Wed, 11 Oct 2023 20:50:33 +0200 Subject: [PATCH] Fix form rendering for bs5 Radiofields are not used, hence implementation has been deleted. --- sipa/initialization.py | 6 ++--- sipa/templates/macros/forms.html | 32 +++++++++------------------ sipa/templates/usersuite/hosting.html | 2 +- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/sipa/initialization.py b/sipa/initialization.py index 0fb951bc..788d95bc 100644 --- a/sipa/initialization.py +++ b/sipa/initialization.py @@ -76,8 +76,8 @@ def init_app(app, **kwargs): app.register_blueprint(bp_register) logger.debug('Registering Jinja globals') - form_label_width = 3 - form_input_width = 7 + form_label_width = 4 + form_input_width = 8 app.jinja_env.globals.update( cf_pages=cf_pages, get_locale=get_locale, @@ -89,7 +89,7 @@ def init_app(app, **kwargs): current_datasource=lambda: backends.datasource, form_label_width_class=f"col-sm-{form_label_width}", form_input_width_class=f"col-sm-{form_input_width}", - form_input_offset_class=f"col-sm-offset-{form_label_width}", + form_input_offset_class=f"offset-sm-{form_label_width}", url_self=url_self, now=datetime.utcnow() ) diff --git a/sipa/templates/macros/forms.html b/sipa/templates/macros/forms.html index 8f61b48e..c72a4b28 100644 --- a/sipa/templates/macros/forms.html +++ b/sipa/templates/macros/forms.html @@ -9,31 +9,21 @@ {{ form.csrf_token }} {% for field in form -%}{% if field and field.id != 'csrf_token' %} {% if loop.index0 == 0 %}{% set focus = true %}{% endif %} -
+
{% if field.type == "BooleanField" %}
-
-
-
- {% elif field.type == "RadioField" %} -
- {{ field.label() }} -
-
- {% for subfield in field %} -
- {% endfor %} + {% set label=field.label(class_="form-check-label") %} +
+ + + + {% if links %}{{ label | render_links(links) | safe }} + {% else %}{{ label }}{% endif %} +
{% elif field.type != "HiddenField" %} -
+
{{ field.label() }}
diff --git a/sipa/templates/usersuite/hosting.html b/sipa/templates/usersuite/hosting.html index 2ff046f4..e49fa7ac 100644 --- a/sipa/templates/usersuite/hosting.html +++ b/sipa/templates/usersuite/hosting.html @@ -43,7 +43,7 @@ {{ _("Hier kannst Du Deine Datenbank löschen:") }}
-
+