1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #15852: Update total object counts when filtering object lists (#15909)

* Fixes #15852: Update total object counts when filtering object lists

* Misc cleanup
This commit is contained in:
Jeremy Stretch
2024-05-02 10:43:53 -04:00
committed by GitHub
parent 4c93a2d084
commit 17e6d1076a
2 changed files with 7 additions and 3 deletions

View File

@ -43,7 +43,8 @@ Context:
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="object-list-tab" data-bs-toggle="tab" data-bs-target="#object-list" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
{% trans "Results" %} {% badge table.page.paginator.count %}
{% trans "Results" %}
<span class="badge text-bg-secondary total-object-count">{{ table.page.paginator.count }}</span>
</a>
</li>
{% if filter_form %}
@ -88,8 +89,8 @@ Context:
<div class="form-check">
<input type="checkbox" id="select-all" name="_all" class="form-check-input" />
<label for="select-all" class="form-check-label">
{% blocktrans trimmed with count=table.rows|length object_type_plural=table.data.verbose_name_plural %}
Select <strong>all {{ count }} {{ object_type_plural }}</strong> matching query
{% blocktrans trimmed with count=table.page.paginator.count object_type_plural=table.data.verbose_name_plural %}
Select <strong>all <span class="total-object-count">{{ count }}</span> {{ object_type_plural }}</strong> matching query
{% endblocktrans %}
</label>
</div>

View File

@ -11,3 +11,6 @@
{% include 'inc/paginator.html' with htmx=True table=table paginator=table.paginator page=table.page %}
{% endif %}
{% endwith %}
{# Include the updated object count for display elsewhere on the page #}
<div hx-swap-oob="innerHTML:.total-object-count">{{ table.rows|length }}</div>