Update pagination

This commit is contained in:
Edgar P. Burkhart 2023-04-18 16:03:12 +02:00
parent b2bbbb405f
commit 8b0c0d245c
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
4 changed files with 23 additions and 30 deletions

View File

@ -115,3 +115,13 @@ nav > :first-child,
main > :first-child {
margin-top: 0;
}
#pagination {
text-align: center;
font-feature-settings: var(--num);
}
#pagination a {width: 2rem}
#pagination a.cur {
font-weight: 650;
text-decoration: underline dotted;
}

View File

@ -0,0 +1,9 @@
{% load i18n %}
{% if page_obj %}
<p id="pagination">
{% for page in paginator.page_range %}
<a href="?page={{ page }}"
{% if page == page_obj.number %}class="cur"{% endif %}>{{ page }}</a>
{% endfor %}
</p>
{% endif %}

View File

@ -20,22 +20,9 @@
<h1>{% translate "Statements" %}</h1>
{% if object %}<a href="{{ object.get_absolute_url }}">{{ object }}</a>{% endif %}
{% if snapshots %}
{% include "main/list/pagination.html" %}
{% include "main/table/snapshot.html" %}
{% if page_obj %}
<div class="pagination">
<span class="step-links">
{% if page_obj.has_previous %}
<a href="?page=1"></a>
<a href="?page={{ page_obj.previous_page_number }}"></a>
{% endif %}
<span class="current">{{ page_obj.number }}/{{ page_obj.paginator.num_pages }}</span>
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}"></a>
<a href="?page={{ page_obj.paginator.num_pages }}"></a>
{% endif %}
</span>
</div>
{% endif %}
{% include "main/list/pagination.html" %}
{% else %}
<p>{% translate "No snapshots to show" %}</p>
{% endif %}

View File

@ -26,22 +26,9 @@
<a href="{% url "search" %}">{% translate "Search" %}</a>
{% endif %}
{% if transactions %}
{% include "main/list/pagination.html" %}
{% include "main/table/transaction.html" %}
{% if page_obj %}
<div class="pagination">
<span class="step-links">
{% if page_obj.has_previous %}
<a href="?page=1"></a>
<a href="?page={{ page_obj.previous_page_number }}"></a>
{% endif %}
<span class="current">{{ page_obj.number }}/{{ page_obj.paginator.num_pages }}</span>
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}"></a>
<a href="?page={{ page_obj.paginator.num_pages }}"></a>
{% endif %}
</span>
</div>
{% endif %}
{% include "main/list/pagination.html" %}
{% else %}
<p>{% translate "No transactions to show" %}</p>
{% endif %}