depicts/templates/macro.html

33 lines
1.1 KiB
HTML

{# vim: set ft=htmljinja
#}
{% 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>
{% 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 %}