Add pager to browse page.
This commit is contained in:
parent
146b79bde8
commit
c2727e6fc8
5 changed files with 95 additions and 11 deletions
29
templates/macro.html
Normal file
29
templates/macro.html
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{% 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) }}">« 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="sr-only">(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 »</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue