47 lines
1.8 KiB
Twig
47 lines
1.8 KiB
Twig
{#
|
|
/**
|
|
* @file
|
|
* Twitter Bootstrap v4 Sliding pagination control implementation.
|
|
*
|
|
* View that can be used with the pagination module
|
|
* from the Twitter Bootstrap v4 CSS Toolkit
|
|
* https://v4-alpha.getbootstrap.com/components/pagination/
|
|
*
|
|
* @author Carlos Delgado <dev@ourcodeworld.com>
|
|
*/
|
|
#}
|
|
|
|
{% if pageCount > 1 %}
|
|
<div class="pagination mt-3 mb-1">
|
|
{% if startPage > 1 %}
|
|
<a href="{{ path(route, query|merge({(pageParameterName): 1})) }}" class="pagination__item">1</a>
|
|
|
|
{% if startPage == 3 %}
|
|
<a href="{{ path(route, query|merge({(pageParameterName): 2})) }}" class="pagination__item">2</a>
|
|
{% elseif startPage != 2 %}
|
|
<span class="pagination__item disabled">…</span>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% for page in pagesInRange %}
|
|
{% if page != current %}
|
|
<a href="{{ path(route, query|merge({(pageParameterName): page})) }}" class="pagination__item">{{ page }}</a>
|
|
{% else %}
|
|
<span class="pagination__item pagination__item--active">{{ page }}</span>
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% if pageCount > endPage %}
|
|
{% if pageCount > (endPage + 1) %}
|
|
{% if pageCount > (endPage + 2) %}
|
|
<span class="pagination__item disabled">…</span>
|
|
{% else %}
|
|
<a href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}" class="pagination__item">{{ pageCount -1 }}</a>
|
|
{% endif %}
|
|
{% endif %}
|
|
<a href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}" class="pagination__item">{{ pageCount }}</a>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|