From 1416888030b1b52eaf559bf6961222e4e0876301 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 27 Aug 2024 15:30:07 -0400 Subject: [PATCH] Wrap bulk action buttons with .bulk-action-buttons for replacement via HTMX --- netbox/templates/generic/object_list.html | 36 +++++++++++------------ netbox/templates/htmx/table.html | 27 +++++++++-------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/netbox/templates/generic/object_list.html b/netbox/templates/generic/object_list.html index 0d61e58b7f1..a89c5a96006 100644 --- a/netbox/templates/generic/object_list.html +++ b/netbox/templates/generic/object_list.html @@ -81,19 +81,7 @@ {% if table.paginator.num_pages > 1 %}
-
-
- {% if 'bulk_edit' in actions %} - - {% bulk_edit_button model query_params=request.GET %} - - {% endif %} - {% if 'bulk_delete' in actions %} - - {% bulk_delete_button model query_params=request.GET %} - - {% endif %} -
+
+
+ {% if 'bulk_edit' in actions %} + {% bulk_edit_button model query_params=request.GET %} + {% endif %} + {% if 'bulk_delete' in actions %} + {% bulk_delete_button model query_params=request.GET %} + {% endif %} +
@@ -127,12 +123,14 @@ {# Form buttons #}
{% block bulk_buttons %} - {% if 'bulk_edit' in actions %} - {% bulk_edit_button model query_params=request.GET %} - {% endif %} - {% if 'bulk_delete' in actions %} - {% bulk_delete_button model query_params=request.GET %} - {% endif %} +
+ {% if 'bulk_edit' in actions %} + {% bulk_edit_button model query_params=request.GET %} + {% endif %} + {% if 'bulk_delete' in actions %} + {% bulk_delete_button model query_params=request.GET %} + {% endif %} +
{% endblock %}
{# /Form buttons #} diff --git a/netbox/templates/htmx/table.html b/netbox/templates/htmx/table.html index ae480a1cfea..5728789faee 100644 --- a/netbox/templates/htmx/table.html +++ b/netbox/templates/htmx/table.html @@ -15,16 +15,19 @@ {% endwith %}
-{# Include the updated object count for display elsewhere on the page #} -
{{ table.rows|length }}
-{% if 'bulk_edit' in actions %} -
- {% bulk_edit_button model query_params=request.GET %} -
-{% endif %} -{% if 'bulk_delete' in actions %} -
- {% bulk_delete_button model query_params=request.GET %} -
-{% endif %} +{% if request.htmx %} + {# Include the updated object count for display elsewhere on the page #} +
{{ table.rows|length }}
+ {# Update the bulk action buttons with new query parameters #} + {% if actions %} +
+ {% if 'bulk_edit' in actions %} + {% bulk_edit_button model query_params=request.GET %} + {% endif %} + {% if 'bulk_delete' in actions %} + {% bulk_delete_button model query_params=request.GET %} + {% endif %} +
+ {% endif %} +{% endif %}