-
Notifications
You must be signed in to change notification settings - Fork 9
/
paginator.html.twig
25 lines (23 loc) · 1.06 KB
/
paginator.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<div class="paginator">
<ul>
{% if paginator.currentpage != 1 %}
<li> <a class="previous" href="{{ path('_items', { 'offset': paginator.currentpage-1 }) }}">Previous</a>
{% endif %}
{% for i in 1..paginator.numpages%}
{% if paginator.range.0 > 2 and i == paginator.range.0 %}
...
{% endif %}
{% if(i==1 or i==paginator.numpages or i in paginator.range) %}
{% if i==paginator.currentpage %}
<li><a class="active" href="{{ path('_items', { 'offset': i })}}">{{i}}</a></li>
{% else %}
<li><a href="{{ path('_items', { 'offset': i }) }}"> {{i}}</a></li>
{% endif %}
{% endif %}
{% if paginator.range[paginator.midrange -1] < paginator.numpages -1 and i == paginator.range[paginator.midrange-1] %}
...
{% endif %}
{% endfor %}
<li> <a class="next" href="{{ path('_items', { 'offset': paginator.currentpage+1 }) }}">Next</a>
</ul>
</div>