Clean up custom bulk actions

This commit is contained in:
Jeremy Stretch 2025-06-27 14:31:27 -04:00
parent 2be2cdb215
commit 60d80621ed
5 changed files with 18 additions and 32 deletions

View File

@ -753,7 +753,6 @@ class ConfigContextListView(generic.ObjectListView):
filterset = filtersets.ConfigContextFilterSet
filterset_form = forms.ConfigContextFilterForm
table = tables.ConfigContextTable
template_name = 'extras/configcontext_list.html'
actions = (Add, BulkSync, BulkEdit, BulkDelete)

View File

@ -1,10 +1,9 @@
{% extends 'generic/object_list.html' %}
{% load buttons %}
{% load i18n %}
{% block bulk_buttons %}
{% block extra_bulk_buttons %}
{% if perms.dcim.change_device %}
<div class="dropdown">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add Components" %}
</button>
@ -75,9 +74,4 @@
</ul>
</div>
{% endif %}
<div class="bulk-action-buttons">
{% for name, action in actions.items %}
{% bulk_action_button action model %}
{% endfor %}
</div>
{% endblock %}
{% endblock extra_bulk_buttons %}

View File

@ -1,11 +0,0 @@
{% extends 'generic/object_list.html' %}
{% load i18n %}
{% block bulk_buttons %}
{% if perms.extras.sync_configcontext %}
<button type="submit" name="_sync" {% formaction %}="{% url 'extras:configcontext_bulk_sync' %}" class="btn btn-primary">
<i class="mdi mdi-sync" aria-hidden="true"></i> {% trans "Sync Data" %}
</button>
{% endif %}
{{ block.super }}
{% endblock %}

View File

@ -8,13 +8,14 @@
{% comment %}
Blocks:
- title: Page title
- controls: Control elements displayed between the header and content
- extra_controls: Any additional action buttons to display
- tabs: Page tabs
- content: Primary page content
- bulk_buttons: Additional bulk action buttons to display beneath the objects list
- modals: Any pre-loaded modals
- title: Page title
- controls: Control elements displayed between the header and content
- extra_controls: Any additional action buttons to display
- tabs: Page tabs
- content: Primary page content
- bulk_buttons: Bulk action buttons to display beneath the objects list
- extra_bulk_buttons: Addition bulk action buttons
- modals: Any pre-loaded modals
Context:
- model: The model class being listed
@ -117,6 +118,10 @@ Context:
<div class="btn-list d-print-none">
{% block bulk_buttons %}
<div class="bulk-action-buttons">
{# Extra bulk buttons #}
{% block extra_bulk_buttons %}{% endblock %}
{# Default bulk action buttons #}
{% for name, action in actions.items %}
{% bulk_action_button action model %}
{% endfor %}

View File

@ -1,9 +1,9 @@
{% extends 'generic/object_list.html' %}
{% load i18n %}
{% block bulk_buttons %}
{% block extra_bulk_buttons %}
{% if perms.virtualization.change_virtualmachine %}
<div class="dropdown">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add Components" %}
</button>
@ -25,5 +25,4 @@
</ul>
</div>
{% endif %}
{{ block.super }}
{% endblock %}
{% endblock extra_bulk_buttons %}