Created
July 9, 2014 03:17
-
-
Save echevemaster/0ccd6cc2f0e6f8dfaf95 to your computer and use it in GitHub Desktop.
Pagination macro, with Foundation support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro render_pagination(pagination, endpoint) %} | |
<div class="pagination-centered"> | |
<ul class="pagination"> | |
<li class="arrow"> | |
{% if pagination.has_prev %} | |
<a href="{{ url_for(endpoint, page=pagination.prev_num) }}">«</a> | |
{% else %} | |
<a href="{{ url_for(endpoint) }}">«</a> | |
{% endif %} | |
</li> | |
{%- for page in pagination.iter_pages() %} | |
{% if page %} | |
{% if page != pagination.page %} | |
<li><a href="{{ url_for(endpoint, page=page) }}">{{ page }}</a></li> | |
{% else %} | |
<li class="current"><a href="">{{ page }}</a></li> | |
{% endif %} | |
{% else %} | |
<li class="unavailable">…</li> | |
{% endif %} | |
{%- endfor %} | |
<li> | |
{% if pagination.has_next %} | |
<a href="{{ url_for(endpoint, page=pagination.next_num) }}">»</a> | |
{% else %} | |
<a href="{{ url_for(endpoint, page=pagination.page) }}">»</a> | |
{% endif %} | |
</li> | |
</ul> | |
</div> | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment