forked from rc/aircox
templates/list_pagination: add links to first and last pages
This commit is contained in:
parent
cae5bdc1d8
commit
1df0aa7332
45
radiocampus/templates/aircox/widgets/list_pagination.html
Normal file
45
radiocampus/templates/aircox/widgets/list_pagination.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
{% comment %}
|
||||
Context:
|
||||
- is_paginated: if True, page is paginated
|
||||
- page_obj: page object from list view;
|
||||
{% endcomment %}
|
||||
{% load i18n aircox %}
|
||||
|
||||
{% if is_paginated %}
|
||||
<hr/>
|
||||
{% update_query request.GET.copy page=None as GET %}
|
||||
{% with GET.urlencode as GET %}
|
||||
<nav class="nav-urls is-centered" role="pagination" aria-label="{% translate "pagination" %}">
|
||||
<ul class="urls">
|
||||
{% if page_obj.has_previous %}
|
||||
{% comment %}Translators: Bottom of the list, "previous page"{% endcomment %}
|
||||
<a href="?{{ GET }}&page=1">« {% translate "first" %}</a>
|
||||
<a href="?{{ GET }}&page={{ page_obj.previous_page_number }}" class="left"
|
||||
title="{% translate "previous" %}"
|
||||
aria-label="{% translate "previous" %}">
|
||||
{% translate "previous" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<span>
|
||||
{{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
|
||||
</span>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
{% comment %}Translators: Bottom of the list, "nextpage"{% endcomment %}
|
||||
<a href="?{{ GET }}&page={{ page_obj.next_page_number }}" class="right"
|
||||
title="{% translate "next" %}"
|
||||
aria-label="{% translate "next" %}">
|
||||
{% translate "next" %}
|
||||
</a>
|
||||
<a href="?{{ GET }}&page={{ page_obj.paginator.num_pages }}" class="right"
|
||||
title="{% translate "last" %}"
|
||||
aria-label="{% translate "last" %}">
|
||||
{% translate "last" %} »
|
||||
</a>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
</nav>
|
||||
{% endwith %}
|
||||
{% endif %}
|
Loading…
Reference in New Issue
Block a user