1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Replace filter_groups with fieldsets on filter forms

This commit is contained in:
jeremystretch
2022-01-31 16:03:26 -05:00
parent ccb3a75281
commit 353e132cf9
8 changed files with 270 additions and 274 deletions

View File

@@ -7,21 +7,22 @@
{% for field in filter_form.hidden_fields %}
{{ field }}
{% endfor %}
{% if filter_form.field_groups %}
{# List filters by group #}
{% for group in filter_form.field_groups %}
<div class="col col-12">
{% for name in group %}
{% with field=filter_form|get_item:name %}
{% render_field field %}
{% endwith %}
{% endfor %}
</div>
{% if not forloop.last %}
<hr class="card-divider mt-0" />
{# List filters by group #}
{% for heading, fields in filter_form.fieldsets %}
<div class="col col-12">
{% if heading %}
<h6>{{ heading }}</h6>
{% endif %}
{% endfor %}
{% else %}
{% for name in fields %}
{% with field=filter_form|get_item:name %}
{% render_field field %}
{% endwith %}
{% endfor %}
</div>
{% if not forloop.last %}
<hr class="card-divider mt-0" />
{% endif %}
{% empty %}
{# List all non-customfield filters as declared in the form class #}
{% for field in filter_form.visible_fields %}
{% if not filter_form.custom_fields or field.name not in filter_form.custom_fields %}
@@ -30,7 +31,7 @@
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% if filter_form.custom_fields %}
{# List all custom field filters #}
<hr class="card-divider mt-0" />