Last active
July 2, 2018 07:43
-
-
Save froulet/417b87ed61c0a28df5f247a8849f087c to your computer and use it in GitHub Desktop.
Bulma.io v0.6.2 Twig template for Symfony 3.4 pagination
This file contains hidden or 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
{# bulma Sliding pagination control implementation #} | |
{% if pageCount > 1 %} | |
<div class="columns"> | |
<div class="column"> | |
</div> | |
<div class="column"> | |
<ul> | |
<span> | |
{% if previous is defined %} | |
<a class="button" href="{{ path(route, query|merge({(pageParameterName): previous})) }}"><</a> | |
{% else %} | |
<a class="button" disabled><</a> | |
{% endif %} | |
</span> | |
<span> | |
<a class="button" href="{{ path(route, query|merge({(pageParameterName): first})) }}">1</a> | |
</span> | |
{% if pagesInRange[0] - first >= 2%} | |
<span> | |
<span> ... </span> | |
</span> | |
{%endif %} | |
{% for page in pagesInRange %} | |
{% if first != page and page != last %} | |
<span> | |
<a class="button" href="{{ path(route, query|merge({(pageParameterName): page})) }}">{{ page }}</a> | |
</span> | |
{% endif %} | |
{% endfor %} | |
{% if last - pagesInRange[pagesInRange|length - 1] >= 2 %} | |
<span> | |
<span> ... </span> | |
</span> | |
{%endif %} | |
<span> | |
<a class="button" href="{{ path(route, query|merge({(pageParameterName): last})) }}">{{last}}</a> | |
</span> | |
<span> | |
{% if next is defined %} | |
<a class="button" href="{{ path(route, query|merge({(pageParameterName): next})) }}">></a> | |
{% else %} | |
<a class="button" disabled>></a> | |
{%endif%} | |
</span> | |
</ul> | |
</div> | |
<div class="column"> | |
</div> | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment