depicts/templates/macro.html

33 lines
1.1 KiB
HTML
Raw Permalink Normal View History

{# vim: set ft=htmljinja
#}
2019-09-29 20:19:40 +01:00
{% macro render_pagination(pagination) %}
{% if pagination.pages > 1 %}
<nav aria-label="Page navigation example">
<ul class="pagination">
{% if pagination.has_prev %}
<li class="page-item"><a class="page-link" href="{{ url_for_other_page(pagination.page - 1) }}">&laquo; Previous</a></li>
{% endif %}
{%- for page in pagination.iter_pages() %}
{% if page %}
{% if page != pagination.page %}
<li class="page-item"><a class="page-link" href="{{ url_for_other_page(page) }}">{{ page }}</a></li>
{% else %}
<li class="page-item active"><a class="page-link" href="{{ url_for_other_page(page) }}">{{ page }} <span class="visually-hidden">(current)</span></a></li>
2019-09-29 20:19:40 +01:00
{% endif %}
{% else %}
<li><span class="ellipsis"></span></li>
{% endif %}
{%- endfor %}
{% if pagination.has_next %}
<li class="page-item">
<a class="page-link" href="{{ url_for_other_page(pagination.page + 1) }}" aria-label="Next">
<span aria-hidden="true">Next &raquo;</span>
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% endmacro %}