Files
vindn.de/frontend/templates/_pager.html.twig
T

25 lines
1.1 KiB
Twig
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{#
Compact pager: first / previous / current / next / last — deliberately
not a full list of page numbers, since result sets here can run into
the hundreds of pages.
Params:
currentPage, totalPages: integers
routeName: the route to link back to
routeParams: all params to preserve *except* `page` (e.g. category,
q, when, lat, lon, range)
#}
{% if totalPages > 1 %}
<nav class="pager" aria-label="Pagination">
{% if currentPage > 1 %}
<a href="{{ path(routeName, routeParams|merge({page: 1})) }}" aria-label="First page">« First</a>
<a href="{{ path(routeName, routeParams|merge({page: currentPage - 1})) }}" aria-label="Previous page">‹ Prev</a>
{% endif %}
<span class="is-active">Page {{ currentPage }} of {{ totalPages }}</span>
{% if currentPage < totalPages %}
<a href="{{ path(routeName, routeParams|merge({page: currentPage + 1})) }}" aria-label="Next page">Next ›</a>
<a href="{{ path(routeName, routeParams|merge({page: totalPages})) }}" aria-label="Last page">Last »</a>
{% endif %}
</nav>
{% endif %}