templates/layouts/layouts_front/pagination/paginate.html.twig line 1

Open in your IDE?
  1. {#
  2. /**
  3.  * @file
  4.  * Twitter Bootstrap v4 Sliding pagination control implementation.
  5.  *
  6.  * View that can be used with the pagination module
  7.  * from the Twitter Bootstrap CSS Toolkit
  8.  * https://getbootstrap.com/docs/4.5/components/pagination/
  9.  *
  10.  */
  11. #}
  12. {% set buttonName = 'Page' %}
  13. {% set buttonNamePrevious = 'précédente' %}
  14. {% set buttonNameNext = 'suivante' %}
  15. {% if route == 'documents' %}
  16.     {% set buttonName = 'Documents' %}
  17.     {% set buttonNamePrevious = 'précédents' %}
  18.     {% set buttonNameNext = 'suivants' %}
  19. {% elseif route == 'actualite' %}
  20.     {% set buttonName = 'Actualités' %}
  21.     {% set buttonNamePrevious = 'précédents' %}
  22.     {% set buttonNameNext = 'suivants' %}
  23. {% elseif route == 'agenda' %}
  24.     {% set buttonName = 'Evénements' %}
  25.     {% set buttonNamePrevious = 'précédents' %}
  26.     {% set buttonNameNext = 'suivants' %}
  27. {% elseif route == 'liste_annuaire' %}
  28.     {% set buttonName = 'Adresses' %}
  29.     {% set buttonNamePrevious = 'précédentes' %}
  30.     {% set buttonNameNext = 'suivantes' %}
  31. {% endif %}
  32.     {% set label_previous = 'Produits Précédents' %}
  33. {% if pageCount > 1 %}
  34.     <nav class="navPag">
  35.         {% set classAlign = (align is not defined) ? '' : align=='center' ? ' justify-content-center' : (align=='right' ? ' justify-content-end' : '') %}
  36.         {% set classSize = (size is not defined) ? '' : size=='large' ? ' pagination-lg' : (size=='small' ? ' pagination-sm' : '') %}
  37.         <ul class="pagination{{ classAlign }}{{ classSize }}">
  38.             <div class="blocPag" style="min-width: 220px;">
  39.                 {% if previous is defined %}
  40.                     <li class="page-item">
  41.                         <a class="page-link previousPage" rel="prev"
  42.                            href="{{ path(route, query|merge({(pageParameterName): previous})) }}">
  43.                             <p class="previous">
  44.                                 {{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}
  45.                             </p>
  46.                         </a>
  47.                     </li>
  48.                 {% else %}
  49.                     <li class="page-item disabled d-none">
  50.                     <span class="page-link previousPage">
  51.                         {{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}</span>
  52.                     </li>
  53.                 {% endif %}
  54.             </div>
  55.             <div class="d-flex justify-content-center align-content-center">
  56.                 {% if startPage > 1 %}
  57.                     <li class="page-item">
  58.                         <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 1})) }}">1</a>
  59.                     </li>
  60.                     {% if startPage == 3 %}
  61.                         <li class="page-item">
  62.                             <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 2})) }}">2</a>
  63.                         </li>
  64.                     {% elseif startPage != 2 %}
  65.                         <li class="page-item disabled">
  66.                             <span class="page-link">&hellip;</span>
  67.                         </li>
  68.                     {% endif %}
  69.                 {% endif %}
  70.                 {% for page in pagesInRange %}
  71.                     {% if page != current %}
  72.                         <li class="page-item">
  73.                             <a class="page-link"
  74.                                href="{{ path(route, query|merge({(pageParameterName): page})) }}">{{ page }}</a>
  75.                         </li>
  76.                     {% else %}
  77.                         <li class="page-item active">
  78.                             <span class="page-link">{{ page }}</span>
  79.                         </li>
  80.                     {% endif %}
  81.                 {% endfor %}
  82.                 {% if pageCount > endPage %}
  83.                     {% if pageCount > (endPage + 1) %}
  84.                         {% if pageCount > (endPage + 2) %}
  85.                             <li class="page-item disabled">
  86.                                 <span class="page-link">&hellip;</span>
  87.                             </li>
  88.                         {% else %}
  89.                             <li class="page-item">
  90.                                 <a class="page-link"
  91.                                    href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}">{{ pageCount -1 }}</a>
  92.                             </li>
  93.                         {% endif %}
  94.                     {% endif %}
  95.                     <li class="page-item">
  96.                         <a class="page-link"
  97.                            href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}">{{ pageCount }}</a>
  98.                     </li>
  99.                 {% endif %}
  100.             </div>
  101.             <div class="blocPag" style="min-width: 220px;">
  102.                 {% if next is defined %}
  103.                     <li class=" page-item
  104.             ">
  105.                         <a class="page-link nextPage" rel="next"
  106.                            href="{{ path(route, query|merge({(pageParameterName): next})) }}">
  107.                             <p class="next">
  108.                                 {{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}
  109.                             </p>
  110.                         </a>
  111.                     </li>
  112.                 {% else %}
  113.                     <li class="page-item disabled d-none">
  114.                     <span class="page-link nextPage">{{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}&nbsp;
  115.                        </span>
  116.                     </li>
  117.                 {% endif %}
  118.             </div>
  119.         </ul>
  120.     </nav>
  121. {% endif %}