|
@@ -1,17 +1,29 @@
|
|
{% if pagination is defined %}
|
|
{% if pagination is defined %}
|
|
<nav aria-label="pagination">
|
|
<nav aria-label="pagination">
|
|
{% set param = app.request.attributes.get('_route_params')['id'] ?? '' %}
|
|
{% set param = app.request.attributes.get('_route_params')['id'] ?? '' %}
|
|
|
|
+ {% set pages = pagination.getPages() %}
|
|
|
|
+ {% set currentPage = pagination.getCurrentPage() %}
|
|
<ul class="pagination">
|
|
<ul class="pagination">
|
|
- <li class="page-item {{ pagination.getCurrentPage() > 1 ?: 'disabled' }}">
|
|
|
|
|
|
+ {# <li class="page-item">
|
|
<a
|
|
<a
|
|
class="page-link"
|
|
class="page-link"
|
|
- href="{{ path(app.request.attributes.get('_route'), app.request.query|merge({'id': param, 'page': pagination.getCurrentPage() - 1})) }}"
|
|
|
|
|
|
+ href="{{ path(app.request.attributes.get('_route'), app.request.query|merge({'id': param, 'page': 1})) }}"
|
|
>
|
|
>
|
|
- {{ "Previous" | trans }}
|
|
|
|
|
|
+ {{ "First" | trans }}
|
|
|
|
+ </a>
|
|
|
|
+ </li> #}
|
|
|
|
+ <li class="page-item {{ currentPage > 1 ?: 'disabled' }}">
|
|
|
|
+ <a
|
|
|
|
+ class="page-link"
|
|
|
|
+ aria-label="Previous"
|
|
|
|
+ href="{{ path(app.request.attributes.get('_route'), app.request.query|merge({'id': param, 'page': currentPage - 1})) }}"
|
|
|
|
+ >
|
|
|
|
+ <span aria-hidden="true">«</span>
|
|
</a>
|
|
</a>
|
|
</li>
|
|
</li>
|
|
- {% for i in 1..pagination.getPages() %}
|
|
|
|
- <li class="page-item {{ pagination.getCurrentPage() is not same as i ?: 'active'}}">
|
|
|
|
|
|
+ {% for i in 1..pages %}
|
|
|
|
+ {% if (currentPage - i < 3 and currentPage - i > -3) or (i == 1) or (i == pages) %}
|
|
|
|
+ <li class="page-item {{ currentPage is not same as i ?: 'active'}}">
|
|
<a
|
|
<a
|
|
class="page-link"
|
|
class="page-link"
|
|
href="{{ path(app.request.attributes.get('_route'), app.request.query|merge({'id': param, 'page': i} )) }}"
|
|
href="{{ path(app.request.attributes.get('_route'), app.request.query|merge({'id': param, 'page': i} )) }}"
|
|
@@ -19,14 +31,27 @@
|
|
{{ i }}
|
|
{{ i }}
|
|
</a>
|
|
</a>
|
|
</li>
|
|
</li>
|
|
|
|
+ {% elseif currentPage - i == 3 or currentPage - i == -3 %}
|
|
|
|
+ <li class="page-item mx-2">...</li>
|
|
|
|
+ {% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
- <li class="page-item {{ pagination.getCurrentPage() < pagination.getPages() ?: 'disabled' }}">
|
|
|
|
|
|
+ <li class="page-item {{ currentPage < pages ?: 'disabled' }}">
|
|
<a
|
|
<a
|
|
- class="page-link" href="{{ path(app.request.attributes.get('_route'), app.request.query|merge({'id': param, 'page': pagination.getCurrentPage() + 1})) }}"
|
|
|
|
|
|
+ aria-label="Next"
|
|
|
|
+ class="page-link"
|
|
|
|
+ href="{{ path(app.request.attributes.get('_route'), app.request.query|merge({'id': param, 'page': currentPage + 1})) }}"
|
|
>
|
|
>
|
|
- {{ "Next" | trans }}
|
|
|
|
|
|
+ <span aria-hidden="true">»</span>
|
|
</a>
|
|
</a>
|
|
</li>
|
|
</li>
|
|
|
|
+ {# <li class="page-item">
|
|
|
|
+ <a
|
|
|
|
+ class="page-link"
|
|
|
|
+ href="{{ path(app.request.attributes.get('_route'), app.request.query|merge({'id': param, 'page': pages})) }}"
|
|
|
|
+ >
|
|
|
|
+ {{ "Last" | trans }}
|
|
|
|
+ </a>
|
|
|
|
+ </li> #}
|
|
</ul>
|
|
</ul>
|
|
</nav>
|
|
</nav>
|
|
<div class="mb-6"></div>
|
|
<div class="mb-6"></div>
|