diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-07-07 09:39:29 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:47 +0200 |
commit | c01be9de3ea65ab7a5360444e5cc27caebc1c061 (patch) | |
tree | a324f582ed88df9fa6230809600a665baacde36c /ishtar_common/templates/blocks | |
parent | fd232fdba395c96564934052233dd23604082693 (diff) | |
download | Ishtar-c01be9de3ea65ab7a5360444e5cc27caebc1c061.tar.bz2 Ishtar-c01be9de3ea65ab7a5360444e5cc27caebc1c061.zip |
Preventive file - inline forms
Diffstat (limited to 'ishtar_common/templates/blocks')
-rw-r--r-- | ishtar_common/templates/blocks/bs_field_snippet.html | 2 | ||||
-rw-r--r-- | ishtar_common/templates/blocks/bs_formset_snippet.html | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/ishtar_common/templates/blocks/bs_field_snippet.html b/ishtar_common/templates/blocks/bs_field_snippet.html index dcee87f7f..beecf624f 100644 --- a/ishtar_common/templates/blocks/bs_field_snippet.html +++ b/ishtar_common/templates/blocks/bs_field_snippet.html @@ -1,5 +1,5 @@ {% load i18n %} - <div id="main_div-{{field.auto_id}}" class="form-group{% if not field.label %} no-label{% endif %} {% if field.field.widget.attrs.cols or force_large_col %}col-lg-12{% else %}col-lg-6{% endif %}{% if field.errors %} is-invalid{% endif %}{% if field.field.required %} required{% endif %}{% if force_large_col %} full-width{% endif %}" + <div id="main_div-{{field.auto_id}}" class="form-group{% if not field.label %} no-label{% endif %} {% if bs_col_width %}{{bs_col_width}}{% elif field.field.widget.attrs.bs_col_width %}{{field.field.widget.attrs.bs_col_width}}{% else %}{% if field.field.widget.attrs.cols or force_large_col %}col-lg-12{% else %}col-lg-6{% endif %}{% endif %}{% if field.errors %} is-invalid{% endif %}{% if field.field.required %} required{% endif %}{% if force_large_col %} full-width{% endif %}" data-alt-name="{{field.field.alt_name}}"> {% if field.label %}{{ field.label_tag }}{% endif %} {% if extra_field_label %}<label><em>{{extra_field_label}}</em></label>{% endif %} diff --git a/ishtar_common/templates/blocks/bs_formset_snippet.html b/ishtar_common/templates/blocks/bs_formset_snippet.html index 0d089ee1b..3a7e537d3 100644 --- a/ishtar_common/templates/blocks/bs_formset_snippet.html +++ b/ishtar_common/templates/blocks/bs_formset_snippet.html @@ -1,6 +1,9 @@ {% load i18n from_dict %} -<div class="form-row"> +<div id="formset-container-{{formset.prefix}}"> + {{ formset.non_form_errors.as_ul }} + {{ formset.management_form }} {% for form in formset %} + <div class="form-row form-{{formset.prefix}}"> {% if form.non_field_errors and not no_error %} <div class="alert alert-danger" role="alert"> {{form.non_field_errors}} @@ -16,11 +19,26 @@ {% csrf_token %} {% for field in form.visible_fields %} + {% with bs_col_width='col-3' %} {% include "blocks/bs_field_snippet.html" %} + {% endwith %} {% endfor %} {% if form.extra_render %} {{form.extra_render|safe}} {% endif %} + </div> {% endfor %} + {% if formset.dynamic_add %} + <div class="form-row pb-2" id="div-add-form-{{formset.prefix}}"> + <div class="col"> + <button class="btn btn-secondary" id="add-form-{{formset.prefix}}" type="button">{% trans "Add" %}</button> + </div> + </div> + <script> + $(document).ready(function(){ + inline_register_add_button("{{formset.prefix}}"); + }); + </script> + {% endif %} </div> |