mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
generalize usage of the paginate_jinja macro
This commit is contained in:
@ -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 %}
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user