mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-12 05:22:17 +01:00
37 lines
1.4 KiB
HTML
37 lines
1.4 KiB
HTML
{# Render an HTMX-enabled table with paginator #}
|
|
{% load helpers %}
|
|
{% load buttons %}
|
|
{% load render_table from django_tables2 %}
|
|
|
|
{# OOB Swaps to update various components #}
|
|
{% applied_filters model form_filter request.GET %}
|
|
|
|
<div class="htmx-container table-responsive">
|
|
{% 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 placement='top' %}
|
|
{% endif %}
|
|
{% render_table table 'inc/table_htmx.html' %}
|
|
{% if paginator_placement != 'top' %}
|
|
{% include 'inc/paginator.html' with htmx=True table=table paginator=table.paginator page=table.page %}
|
|
{% endif %}
|
|
{% endwith %}
|
|
</div>
|
|
|
|
{% if request.htmx %}
|
|
{# Include the updated object count for display elsewhere on the page #}
|
|
<div hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>
|
|
|
|
{# Update the bulk action buttons with new query parameters #}
|
|
{% if actions %}
|
|
<div class="bulk-action-buttons" hx-swap-oob="outerHTML:.bulk-action-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 %}
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|