25 lines
1.1 KiB
Twig
25 lines
1.1 KiB
Twig
{#
|
||
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 %}
|