This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/resources/views/yuuno/elements/pagination.twig

25 lines
1.7 KiB
Twig
Raw Normal View History

2016-11-04 17:51:11 +00:00
{% set paginationSeparator %}{% if '%3F' in paginationUrl|default('')|url_encode %}&{% else %}?{% endif %}{% endset %}
{% set paginationPage = get.page|default(1) %}
<div class="pagination{% if paginationClass %} {{ paginationClass }}{% endif %}">
2016-11-04 17:51:11 +00:00
{% if paginationPages is defined and paginationPages|length > 1 %}
{% if paginationPage > 1 %}
{% if paginationPages|length > 2 %}
2016-11-09 18:32:23 +00:00
<a class="input__button" href="{{ paginationUrl }}{{ paginationSeparator }}page=1" title="Jump to first page"><span class="fa fa-fast-backward"></span></a>
{% endif %}
2016-11-09 18:32:23 +00:00
<a class="input__button" href="{{ paginationUrl }}{{ paginationSeparator }}page={{ paginationPage - 1 }}" title="Previous page"><span class="fa fa-step-backward"></span></a>
{% endif %}
{% for id,page in paginationPages %}
{% if (id + 1) > (paginationPage - 3) and (id + 1) < (paginationPage + 3) %}
2016-11-09 18:32:23 +00:00
<a class="input__button{% if id == paginationPage - 1 %} input__button--current{% endif %}" href="{{ paginationUrl }}{{ paginationSeparator }}page={{ id + 1 }}" title="Page {{ id + 1 }}">{{ id + 1 }}</a>
{% endif %}
{% endfor %}
{% if paginationPage < paginationPages|length %}
2016-11-09 18:32:23 +00:00
<a class="input__button" href="{{ paginationUrl }}{{ paginationSeparator }}page={{ paginationPage + 1 }}" title="Next page"><span class="fa fa-step-forward"></span></a>
{% if paginationPages|length > 2 %}
2016-11-09 18:32:23 +00:00
<a class="input__button" href="{{ paginationUrl }}{{ paginationSeparator }}page={{ paginationPages|length }}" title="Jump to last page"><span class="fa fa-fast-forward"></span></a>
{% endif %}
{% endif %}
{% endif %}
</div>