mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Update display of filtering chits
This commit is contained in:
parent
852535e3d4
commit
f2c74db761
@ -198,13 +198,9 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin):
|
||||
# Hide selection checkboxes
|
||||
if 'pk' in table.base_columns:
|
||||
table.columns.hide('pk')
|
||||
filter_chits = render_to_string('inc/applied_filters_pane.html', {
|
||||
'model': model,
|
||||
'filter_form': filterset_form,
|
||||
}, request)
|
||||
return render(request, 'htmx/table.html', {
|
||||
'table': table,
|
||||
'filter_chits': filter_chits,
|
||||
'filter_form': filterset_form,
|
||||
'model': model,
|
||||
'actions': actions,
|
||||
})
|
||||
|
@ -68,7 +68,7 @@ Context:
|
||||
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
|
||||
|
||||
{# Applied filters #}
|
||||
{% include 'inc/applied_filters_pane.html' %}
|
||||
{% applied_filters model form_filter request.GET %}
|
||||
|
||||
{# Object table controls #}
|
||||
{% include 'inc/table_controls_htmx.html' with table_modal="ObjectTable_config" %}
|
||||
|
@ -4,7 +4,7 @@
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{# OOB Swaps to update various components #}
|
||||
{{ filter_chits }}
|
||||
{% applied_filters model form_filter request.GET %}
|
||||
|
||||
<div class="htmx-container table-responsive">
|
||||
{% with preferences|get_key:"pagination.placement" as paginator_placement %}
|
||||
|
@ -1,8 +0,0 @@
|
||||
{% load helpers %}
|
||||
|
||||
<div id="applied_filters_pane" hx-swap-oob="true">
|
||||
{# Applied filters #}
|
||||
{% if filter_form %}
|
||||
{% applied_filters model filter_form request.GET %}
|
||||
{% endif %}
|
||||
</div>
|
@ -1,20 +1,22 @@
|
||||
{% load i18n %}
|
||||
{% if applied_filters %}
|
||||
<div class="mb-3">
|
||||
{% for filter in applied_filters %}
|
||||
<a href="{{ filter.link_url }}" class="badge rounded-pill text-bg-primary text-decoration-none me-1">
|
||||
<i class="mdi mdi-close"></i> {{ filter.link_text }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% if applied_filters|length > 1 %}
|
||||
<a href="?" class="badge rounded-pill text-bg-danger text-decoration-none me-1">
|
||||
<i class="mdi mdi-tag-off"></i> {% trans "Clear all" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if save_link %}
|
||||
<a href="{{ save_link }}" class="badge rounded-pill text-bg-success text-decoration-none me-1">
|
||||
<i class="mdi mdi-content-save"></i> {% trans "Save" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="applied_filters_pane" hx-swap-oob="true">
|
||||
{% if applied_filters %}
|
||||
<div class="mb-3">
|
||||
{% for filter in applied_filters %}
|
||||
<a href="{{ filter.link_url }}" class="badge rounded-pill text-bg-primary text-decoration-none me-1">
|
||||
<i class="mdi mdi-close"></i> {{ filter.link_text }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% if applied_filters|length > 1 %}
|
||||
<a href="?" class="badge rounded-pill text-bg-danger text-decoration-none me-1">
|
||||
<i class="mdi mdi-tag-off"></i> {% trans "Clear all" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if save_link %}
|
||||
<a href="{{ save_link }}" class="badge rounded-pill text-bg-success text-decoration-none me-1">
|
||||
<i class="mdi mdi-content-save"></i> {% trans "Save" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
@ -57,6 +57,7 @@ def widget_type(field):
|
||||
# Inclusion tags
|
||||
#
|
||||
|
||||
|
||||
@register.inclusion_tag('form_helpers/render_fieldset.html')
|
||||
def render_fieldset(form, fieldset):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user