From 1c995fa5f9876874e8300f3a427500c3c9ec0230 Mon Sep 17 00:00:00 2001 From: Daniel Sheppard Date: Mon, 15 Apr 2024 08:43:51 -0500 Subject: [PATCH] Perform OOB swap for filter badges --- netbox/netbox/views/generic/bulk_views.py | 2 ++ netbox/templates/generic/object_list.html | 4 +--- netbox/templates/htmx/table.html | 3 +++ netbox/templates/inc/applied_filters_pane.html | 8 ++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 netbox/templates/inc/applied_filters_pane.html diff --git a/netbox/netbox/views/generic/bulk_views.py b/netbox/netbox/views/generic/bulk_views.py index 619358c66..c62c375c4 100644 --- a/netbox/netbox/views/generic/bulk_views.py +++ b/netbox/netbox/views/generic/bulk_views.py @@ -181,7 +181,9 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin): if 'pk' in table.base_columns: table.columns.hide('pk') return render(request, 'htmx/table.html', { + 'model': model, 'table': table, + 'filter_form': filterset_form, }) context = { diff --git a/netbox/templates/generic/object_list.html b/netbox/templates/generic/object_list.html index bf0777406..8a92ad1b9 100644 --- a/netbox/templates/generic/object_list.html +++ b/netbox/templates/generic/object_list.html @@ -63,9 +63,7 @@ Context:
{# Applied filters #} - {% if filter_form %} - {% applied_filters model filter_form request.GET %} - {% endif %} + {% include 'inc/applied_filters_pane.html' %} {# Object table controls #} {% include 'inc/table_controls_htmx.html' with table_modal="ObjectTable_config" %} diff --git a/netbox/templates/htmx/table.html b/netbox/templates/htmx/table.html index 1ad1a7bc1..3de4ae732 100644 --- a/netbox/templates/htmx/table.html +++ b/netbox/templates/htmx/table.html @@ -2,6 +2,9 @@ {% load helpers %} {% load render_table from django_tables2 %} +{# Applied filters #} +{% include 'inc/applied_filters_pane.html' %} + {% with preferences|get_key:"pagination.placement" as paginator_placement %} {% if paginator_placement == 'top' or paginator_placement == 'both' %} {% include 'inc/paginator.html' with htmx=True table=table paginator=table.paginator page=table.page %} diff --git a/netbox/templates/inc/applied_filters_pane.html b/netbox/templates/inc/applied_filters_pane.html new file mode 100644 index 000000000..073606ccf --- /dev/null +++ b/netbox/templates/inc/applied_filters_pane.html @@ -0,0 +1,8 @@ +{% load helpers %} + +
+ {# Applied filters #} + {% if filter_form %} + {% applied_filters model filter_form request.GET %} + {% endif %} +