66 lines
1.7 KiB
HTML
66 lines
1.7 KiB
HTML
{% comment %}
|
|
Options:
|
|
- list_css_class: extra class for the main list container
|
|
- list_paginator: paginator object to display pagination at the bottom;
|
|
{% endcomment %}
|
|
|
|
{% load i18n %}
|
|
{% load aircox_cms %}
|
|
|
|
|
|
<ul class="list {{ list_css_class|default:'' }}">
|
|
{% for page in object_list %}
|
|
{% with item=page.specific %}
|
|
{% include "aircox_cms/snippets/list_item.html" %}
|
|
{% endwith %}
|
|
{% endfor %}
|
|
|
|
{# we use list_paginator to avoid conflicts when there are multiple lists #}
|
|
{% if list_paginator and list_paginator.num_pages > 1 %}
|
|
<nav>
|
|
{% with list_paginator.num_pages as num_pages %}
|
|
{% if object_list.has_previous %}
|
|
<a href="?page={{ object_list.previous_page_number }}">
|
|
{% trans "previous page" %}
|
|
</a>
|
|
{% endif %}
|
|
|
|
{% if object_list.number > 3 %}
|
|
<a href="?page=1">1</a>
|
|
{% if object_list.number > 4 %}
|
|
…
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% for i in object_list.number|around:2 %}
|
|
{% if i == object_list.number %}
|
|
{{ object_list.number }}
|
|
{% elif i > 0 and i <= num_pages %}
|
|
<a href="?page={{ i }}">{{ i }}</a>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% with object_list.number|add:"2" as max %}
|
|
{% if max < num_pages %}
|
|
{% if max|add:"1" < num_pages %}
|
|
…
|
|
{% endif %}
|
|
<a href="?page={{ num_pages }}">{{ num_pages }}</a>
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
{% if object_list.has_next %}
|
|
<a href="?page={{ object_list.next_page_number }}">
|
|
{% trans "next page" %}
|
|
</a>
|
|
{% endif %}
|
|
{% endwith %}
|
|
</nav>
|
|
{% elif url and url_text %}
|
|
<nav><a href="{{ url }}">{{ url_text }}</a></nav>
|
|
{% endif %}
|
|
|
|
</ul>
|
|
|
|
|