generalize usage of the paginate_jinja macro

This commit is contained in:
thomas girod
2024-09-25 14:35:13 +02:00
parent 6449724ed5
commit 1800785b80
11 changed files with 25 additions and 15 deletions

View File

@ -11,6 +11,7 @@
<link rel="stylesheet" href="{{ scss('core/markdown.scss') }}">
<link rel="stylesheet" href="{{ scss('core/header.scss') }}">
<link rel="stylesheet" href="{{ scss('core/navbar.scss') }}">
<link rel="stylesheet" href="{{ scss('core/pagination.scss') }}">
<link rel="stylesheet" href="{{ static('vendored/select2/select2.min.css') }}">
{% block jquery_css %}

View File

@ -157,6 +157,15 @@
{% endmacro %}
{% macro paginate_jinja(current_page, paginator) %}
{# Add pagination buttons for pages without Alpine.
This must be coupled with a view that handles pagination
with the Django Paginator object.
Parameters:
current_page (django.core.paginator.Page): the current page object
paginator (django.core.paginator.Paginator): the paginator object
#}
<nav class="pagination">
{% if current_page.has_previous() %}
<a href="?page={{ current_page.previous_page_number() }}">
@ -170,8 +179,8 @@
{% for i in paginator.get_elided_page_range(current_page.number) %}
{% if i == current_page.number %}
<button class="active">{{ i }}</button>
{% elif i == paginator.ELLIPSIS %}
<strong>{{ paginator.ELLIPSIS }}</strong>
{% elif i == paginator.ELLIPSIS %}
<strong>{{ paginator.ELLIPSIS }}</strong>
{% else %}
<a href="?page={{ i }}">
<button>{{ i }}</button>