mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-21 23:31:18 +00:00
generalize usage of the paginate_jinja macro
This commit is contained in:
parent
6449724ed5
commit
1800785b80
@ -53,6 +53,7 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{# TODO: Replace this pagination by an Alpine pagination #}
|
||||
<script type="text/javascript">
|
||||
function formPagination(link){
|
||||
$("form").attr("action", link.href);
|
||||
|
@ -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>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import user_profile_link, paginate %}
|
||||
{% from 'core/macros.jinja' import user_profile_link, paginate_jinja %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Cash register summary list{% endtrans %}
|
||||
@ -57,7 +57,7 @@
|
||||
</table>
|
||||
<br>
|
||||
{% if is_paginated %}
|
||||
{{ paginate(page_obj, paginator) }}
|
||||
{{ paginate_jinja(page_obj, paginator) }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% trans %}There is no cash register summary in this website.{% endtrans %}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import paginate %}
|
||||
{% from "core/macros.jinja" import paginate_jinja %}
|
||||
|
||||
{% block title %}
|
||||
{%- trans %}Reloads list{% endtrans %} -- {{ counter.name }}
|
||||
@ -28,7 +28,7 @@
|
||||
{%- endfor %}
|
||||
</table>
|
||||
{% if is_paginated %}
|
||||
{{ paginate(page_obj, paginator) }}
|
||||
{{ paginate_jinja(page_obj, paginator) }}
|
||||
{% endif %}
|
||||
{%- endblock %}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import paginate %}
|
||||
{% from "core/macros.jinja" import paginate_jinja %}
|
||||
|
||||
{% block title %}
|
||||
{%- trans %}Election list{% endtrans %}
|
||||
@ -46,7 +46,7 @@
|
||||
</section>
|
||||
{%- endfor %}
|
||||
{% if is_paginated %}
|
||||
{{ paginate(page_obj, paginator) }}
|
||||
{{ paginate_jinja(page_obj, paginator) }}
|
||||
{% endif %}
|
||||
{%- endblock %}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ scss('forum/css/forum.scss') }}">
|
||||
<link rel="stylesheet" href="{{ scss('core/pagination.scss') }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% from "core/macros.jinja" import user_mini_profile, paginate %}
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from "core/macros.jinja" import user_mini_profile, paginate_jinja %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Search user{% endtrans %}
|
||||
@ -18,7 +18,9 @@
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
{{ paginate(page_obj, paginator) }}
|
||||
{% if page_obj.has_other_pages() %}
|
||||
{{ paginate_jinja(page_obj, paginator) }}
|
||||
{% endif %}
|
||||
<hr>
|
||||
{% endif %}
|
||||
<h2>{% trans %}Search user{% endtrans %}</h2>
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
{% block additional_css %}
|
||||
<link rel="stylesheet" href="{{ scss('pedagogy/css/pedagogy.scss') }}">
|
||||
<link rel="stylesheet" href="{{ scss('core/pagination.scss') }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import paginate %}
|
||||
{% from "core/macros.jinja" import paginate_jinja %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Operation logs{% endtrans %}
|
||||
@ -28,5 +28,5 @@
|
||||
</table>
|
||||
|
||||
<br>
|
||||
{{ paginate(page_obj, paginator) }}
|
||||
{{ paginate_jinja(page_obj, paginator) }}
|
||||
{% endblock content %}
|
@ -3,7 +3,6 @@
|
||||
|
||||
{%- block additional_css -%}
|
||||
<link rel="stylesheet" href="{{ scss('sas/css/album.scss') }}">
|
||||
<link rel="stylesheet" href="{{ scss('core/pagination.scss') }}">
|
||||
{%- endblock -%}
|
||||
|
||||
{% block title %}
|
||||
|
Loading…
Reference in New Issue
Block a user