templates/frontend/dataset/pager.html.twig line 1

Open in your IDE?
  1. {#
  2. /**
  3.  * @file
  4.  * Twitter Bootstrap v4-beta.2 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.4/components/pagination/
  9.  *
  10.  */
  11. #}
  12. <style>
  13. .page-link{
  14.     color: #74abad;
  15. }
  16. .page-item.active .page-link {
  17.     background-color: #74abad;
  18.     border-color: #74abad;
  19. }
  20. </style>
  21. {% if pageCount > 1 %}
  22.     <nav>
  23.         {% set classAlign = (align is not defined) ? '' : align=='center' ? ' justify-content-center' : (align=='right' ? ' justify-content-end' : '') %}
  24.         {% set classSize = (size is not defined) ? '' : size=='large' ? ' pagination-lg' : (size=='small' ? ' pagination-sm' : '') %}
  25.         <ul class="pagination{{ classAlign }}{{ classSize }}">
  26.             {% if previous is defined %}
  27.                 <li class="page-item">
  28.                     <a class="page-link" rel="prev" href="{{ path(route, query|merge({(pageParameterName): previous})) }}">&laquo;&nbsp;{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}</a>
  29.                 </li>
  30.             {% else %}
  31.                 <li class="page-item disabled">
  32.                     <span class="page-link">&laquo;&nbsp;{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}</span>
  33.                 </li>
  34.             {% endif %}
  35.             {% if startPage > 1 %}
  36.                 <li class="page-item">
  37.                     <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 1})) }}">1</a>
  38.                 </li>
  39.                 {% if startPage == 3 %}
  40.                     <li class="page-item">
  41.                         <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): 2})) }}">2</a>
  42.                     </li>
  43.                 {% elseif startPage != 2 %}
  44.                     <li class="page-item disabled">
  45.                         <span class="page-link">&hellip;</span>
  46.                     </li>
  47.                 {% endif %}
  48.             {% endif %}
  49.             {% for page in pagesInRange %}
  50.                 {% if page != current %}
  51.                     <li class="page-item">
  52.                         <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): page})) }}">{{ page }}</a>
  53.                     </li>
  54.                 {% else %}
  55.                     <li class="page-item active">
  56.                         <span class="page-link">{{ page }}</span>
  57.                     </li>
  58.                 {% endif %}
  59.             {% endfor %}
  60.             {% if pageCount > endPage %}
  61.                 {% if pageCount > (endPage + 1) %}
  62.                     {% if pageCount > (endPage + 2) %}
  63.                         <li class="page-item disabled">
  64.                             <span class="page-link">&hellip;</span>
  65.                         </li>
  66.                     {% else %}
  67.                         <li class="page-item">
  68.                             <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}">{{ pageCount -1 }}</a>
  69.                         </li>
  70.                     {% endif %}
  71.                 {% endif %}
  72.                 <li class="page-item">
  73.                     <a class="page-link" href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}">{{ pageCount }}</a>
  74.                 </li>
  75.             {% endif %}
  76.             {% if next is defined %}
  77.                 <li class="page-item">
  78.                     <a class="page-link" rel="next" href="{{ path(route, query|merge({(pageParameterName): next})) }}">{{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}&nbsp;&raquo;</a>
  79.                 </li>
  80.             {% else %}
  81.                 <li  class="page-item disabled">
  82.                     <span class="page-link">{{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}&nbsp;&raquo;</span>
  83.                 </li>
  84.             {% endif %}
  85.         </ul>
  86.     </nav>
  87. {% endif %}