16756 don't duplicate code

This commit is contained in:
Arthur Hanson 2024-08-13 14:30:57 +07:00
parent 7b21ee484f
commit f64050a9f5
2 changed files with 2 additions and 17 deletions

View File

@ -1,7 +1,6 @@
{% load helpers %} {% load helpers %}
{% load log_levels %} {% load log_levels %}
{% load i18n %} {% load i18n %}
{% load render_table from django_tables2 %}
<div class="htmx-container"> <div class="htmx-container">
<p> <p>
@ -42,21 +41,7 @@
<div class="card"> <div class="card">
<div class="table-responsive" id="object_list"> <div class="table-responsive" id="object_list">
<h5 class="card-header">{% trans "Log" %}</h5> <h5 class="card-header">{% trans "Log" %}</h5>
{% include 'htmx/table.html' with no_htmx_container=True%}
<div class="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>
{# Include the updated object count for display elsewhere on the page #}
<div class="d-none" hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -2,7 +2,7 @@
{% load helpers %} {% load helpers %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
<div class="htmx-container table-responsive"> <div class="{% if not no_htmx_container %}htmx-container{% endif %} table-responsive">
{% with preferences|get_key:"pagination.placement" as paginator_placement %} {% with preferences|get_key:"pagination.placement" as paginator_placement %}
{% if paginator_placement == 'top' or paginator_placement == 'both' %} {% 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' %} {% include 'inc/paginator.html' with htmx=True table=table paginator=table.paginator page=table.page placement='top' %}