Add pagination to month archive view (fix #13)

This commit is contained in:
Edgar P. Burkhart 2023-12-30 09:04:52 +01:00
parent c3ba376793
commit 5013df903f
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 16 additions and 5 deletions

View file

@ -135,17 +135,21 @@ footer {
font-weight: 250; font-weight: 250;
} }
#pagination { .pagination {
text-align: center; text-align: center;
font-feature-settings: var(--num); font-feature-settings: var(--num);
} }
#pagination a { .pagination a {
width: 2rem; min-width: 1rem;
padding: 0 0.5rem;
} }
#pagination a.cur { .pagination a.cur {
font-weight: 650; font-weight: 650;
text-decoration: underline dotted; text-decoration: underline dotted;
} }
.pagination a.cur:hover {
text-decoration: underline;
}
@media (width < 1024px) { @media (width < 1024px) {
body { body {

View file

@ -1,9 +1,16 @@
{% load i18n %} {% load i18n %}
{% if page_obj %} {% if page_obj %}
<p id="pagination"> <p class="pagination">
{% for page in paginator.page_range %} {% for page in paginator.page_range %}
<a href="?page={{ page }}" <a href="?page={{ page }}"
{% if page == page_obj.number %}class="cur"{% endif %}>{{ page }}</a> {% if page == page_obj.number %}class="cur"{% endif %}>{{ page }}</a>
{% endfor %} {% endfor %}
</p> </p>
{% endif %} {% endif %}
{% if month %}
<p class="pagination">
<a href="{% url "transaction_month" previous_month|date:"Y" previous_month|date:"m" %}">{{ previous_month|date:"F Y"|capfirst }}</a>
<a href="" class="cur">{{ month|date:"F Y"|capfirst }}</a>
<a href="{% url "transaction_month" next_month|date:"Y" next_month|date:"m" %}">{{ next_month|date:"F Y"|capfirst }}</a>
</p>
{% endif %}