diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-16 12:45:00 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-16 12:46:09 +0200 | 
| commit | 12e9870e2aa0659de98a9122fbc4ab16b0877449 (patch) | |
| tree | 36d375089b787fbc3649ad54bb9e7e3b2b5741e0 /ishtar_common | |
| parent | db5ecbb7b69ff668ca005bd9535bf595b79e649e (diff) | |
| download | Ishtar-12e9870e2aa0659de98a9122fbc4ab16b0877449.tar.bz2 Ishtar-12e9870e2aa0659de98a9122fbc4ab16b0877449.zip  | |
✨ Context records relations: remove form from the wizard to put in a specific form
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/models.py | 1 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/forms/modify_parcels.html | 6 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/forms/modify_relations.html | 59 | 
3 files changed, 62 insertions, 4 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 48ed55e77..b9bd1351e 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -905,7 +905,6 @@ class RelationsViews(models.Model):          if not settings.USE_BACKGROUND_TASK:              return relation_view_update(cls, {"item_id": item_id})          else: -              sender, kwargs = serialize_args_for_tasks(cls, None, {"item_id": item_id})              task_item = relation_view_update.delay(sender, kwargs)              revoke_old_task(kwargs, "relation_view_update", task_item.id, cls) diff --git a/ishtar_common/templates/ishtar/forms/modify_parcels.html b/ishtar_common/templates/ishtar/forms/modify_parcels.html index 4c7c39120..c6d50fdef 100644 --- a/ishtar_common/templates/ishtar/forms/modify_parcels.html +++ b/ishtar_common/templates/ishtar/forms/modify_parcels.html @@ -20,11 +20,11 @@                      <table class='inline-table'>                          <tr>                              {% for field in formset.forms.0 %} -                            {% if field.name != 'pk' %}{% if field.required %}<th{%else%}<td{% endif %}{% if not forloop.last %} rowspan='2'{% endif %}> -                            {{ field.label_tag }}{% if field.required %}</th>{%else%}</td>{% endif %}{% endif %}{% endfor %} +                            {% if field.name != 'pk' %}<th{% if not forloop.last %} rowspan='2'{% endif %}> +                            {{field.label}}</th>{% endif %}{% endfor %}                          </tr>                          <tr><td>({% trans "all"%} <input type='checkbox' name='check-all' class='check-all-parcel'/>)</td></tr> -                        {% inline_formset 'Parcels' formset.forms False %} +                        {% inline_formset _('Parcels') formset.forms False %}                      </table>                      {% endblock %} diff --git a/ishtar_common/templates/ishtar/forms/modify_relations.html b/ishtar_common/templates/ishtar/forms/modify_relations.html new file mode 100644 index 000000000..faec8b3fc --- /dev/null +++ b/ishtar_common/templates/ishtar/forms/modify_relations.html @@ -0,0 +1,59 @@ +{% load i18n l10n inline_formset table_form %} + +<div class="modal-dialog modal-lg"> +    <div class="modal-content"> +        <div class="modal-header"> +            <h2>{{ formset.form_label }}</h2> +            <button type="button" class="close" data-dismiss="modal" aria-label="Close"> +                <span aria-hidden="true">×</span> +            </button> +        </div> +        <form enctype="multipart/form-data" action="{{url}}" method="post" id="qa-action"> +            {{ formset.management_form }} +            {% csrf_token %} +            <div class="modal-body body-scroll"> +                <div class='form'> +                    {% block main_form %} +                    <table class='w-100 inline-table text-center'> +                        <tr> +                            {% for field in formset.forms.0 %} +                            {% if field.name != 'pk' %}<th{% if not forloop.last %} rowspan='2'{% endif %}> +                            {% if field.label %}{{field.label}}{% else %}{% trans "Delete" %}{% endif %}</th>{% endif %}{% endfor %} +                        </tr> +                        <tr><td>({% trans "all"%} <input type='checkbox' name='check-all' class='check-all-relations'/>)</td></tr> +                        {% inline_formset _("Relations") formset.forms False %} +                    </table> +                    {% endblock %} +                </div> +            </div> +            <div class="modal-footer"> +                {% block footer %} +                    <button type="submit" id="submit_form" name='validate' +                        value="validate" class="btn btn-success"> +                        {% if action_name %} +                            {{ action_name }} +                        {% else %} +                            {% trans "Add/Modify" %} +                        {% endif %} +                    </button> +                    <button type="button" data-dismiss="modal" +                        aria-label="Close" class="btn btn-secondary"> +                        {% trans "Close" %} +                    </button> +                {% endblock %} +            </div> +        </form> +    </div> +</div> +<script type="text/javascript">{% localize off %} +    {% block js %} +    {% endblock %} +    $(document).ready(function(){ +        qa_action_register("{{url}}"); +        $(document).on("click", '.check-all-relations', function(){ +           $('input[id$="-DELETE"]:checkbox').prop('checked', $(this).is(':checked')); +        }); +    {% block js_ready %} +    {% endblock %} +    }); +{% endlocalize %}</script>  | 
