diff --git a/app/public/static/collection_editor.js b/app/public/static/collection_editor.js index 7aba9719..b7ae343a 100644 --- a/app/public/static/collection_editor.js +++ b/app/public/static/collection_editor.js @@ -9,7 +9,6 @@ function updateOrder() { .map(x => x.dataset.id) .filter(x => x); - console.log(ids); document.querySelector("input[name='order']").value = ids.join(","); } diff --git a/app/templates/macros/forms.html b/app/templates/macros/forms.html index b0fa983e..947e3de4 100644 --- a/app/templates/macros/forms.html +++ b/app/templates/macros/forms.html @@ -4,12 +4,30 @@ {% endfor %} {% endmacro %} +{% macro render_label(field, label=None, label_visible=true) %} + {% if field.type != 'HiddenField' %} + {% if not label and label != "" %}{% set label=field.label.text %}{% endif %} + {% if label %} + + {% if field.flags.required and label_visible %} + + + + + + + {{ _("Required") }} + + {% endif %} + {% endif %} + {% endif %} +{% endmacro %} + {% macro render_field(field, label=None, label_visible=true, right_url=None, right_label=None, fieldclass=None, hint=None) -%}
- {% if field.type != 'HiddenField' %} - {% if not label and label != "" %}{% set label=field.label.text %}{% endif %} - {% if label %}{% endif %} - {% endif %} + {{ render_label(field, label, label_visible) }} {{ field(class_=fieldclass or 'form-control', **kwargs) }} {% if hint %} {{ hint | safe }} @@ -20,11 +38,7 @@ {% macro render_field_prefix(field, label=None, prefix="@", label_visible=true, right_url=None, right_label=None, fieldclass=None) -%}
- {% if field.type != 'HiddenField' and label_visible %} - {% if not label and label != "" %}{% set label=field.label.text %}{% endif %} - {% if label %}{% endif %} - {% endif %} - + {{ render_label(field, label, label_visible) }}
{{ prefix }} @@ -38,11 +52,7 @@ {% macro render_field_prefix_button(field, label=None, prefix="@", label_visible=true, right_url=None, right_label=None, fieldclass=None, has_view=False, hint=None) -%}
- {% if field.type != 'HiddenField' and label_visible %} - {% if not label and label != "" %}{% set label=field.label.text %}{% endif %} - {% if label %}{% endif %} - {% endif %} - + {{ render_label(field, label, label_visible) }}
{{ prefix }} @@ -104,10 +114,7 @@ {% macro render_multiselect_field(field, label=None, label_visible=true, right_url=None, right_label=None) -%}
- {% if field.type != 'HiddenField' and label_visible %} - {% if not label %}{% set label=field.label.text %}{% endif %} - - {% endif %} + {{ render_label(field, label, label_visible) }}
@@ -129,10 +136,7 @@ {% macro render_radio_field(field, hint=None, label=None, label_visible=true) -%}
- {% if label_visible %} - {% if not label and label != "" %}{% set label=field.label.text %}{% endif %} - {% if label %}{% endif %} - {% endif %} + {{ render_label(field, label, label_visible) }} {% for value, label, checked in field.iter_choices() %}