PCv5/app/templates/widgets/pagination.html
Lephe 17c78204a6
update the route model for the forum to <id>/<page>/<slug>
This works by bundling the topic object and page number in a pair during
conversion to/from URL, so that the slug can be computed effortlessly
and put in all links.
2020-07-16 23:58:21 +02:00

22 lines
788 B
HTML

{% macro paginate(objects, route, obj, route_args) %}
<div class="pagination">
{% if objects.has_prev %}
<a href="{{ _url_for(route, route_args, page=(obj,objects.prev_num)) }}">Page précédente</a> |
{% endif %}
{% for page in objects.iter_pages(1, 5, 6, 1) %}
{% if not page %}
{% elif page != objects.page %}
<a href="{{ _url_for(route, route_args, page=(obj,page)) }}">{{ page }}</a>
{% else %}
<strong>{{ page }}</strong>
{% endif %}
{% endfor %}
{% if objects.has_next %}
| <a href="{{ _url_for(route, route_args, page=(obj,objects.next_num)) }}">Page suivante</a>
{% endif %}
</div>
{% endmacro %}