templates/bundles/KnpPaginator/pagination.html.twig line 1

Open in your IDE?
  1. {#
  2. /**
  3.  * @file
  4.  * Foundation 5 Sliding pagination control implementation.
  5.  *
  6.  * View that can be used with the pagination module 
  7.  * from the Foundation 5 CSS Toolkit
  8.  * http://foundation.zurb.com/docs/components/pagination.html
  9.  *
  10.  * @author Vincent Loy <vincent.loy1@gmail.com>
  11.  *
  12.  * This view have been ported from twitter bootstrap v3 pagination control implementation
  13.  * from :
  14.  * @author Pablo Díez <pablodip@gmail.com>
  15.  * @author Jan Sorgalla <jsorgalla@gmail.com>
  16.  * @author Artem Ponomarenko <imenem@inbox.ru>
  17.  * @author Artem Zabelin <artjomzabelin@gmail.com>
  18.  */
  19. #}
  20. {% if pageCount > 1 %}
  21. <div class="grid-x">
  22.   <nav class="flex-container pagination t-label-regular medium-shrink cell">
  23.     <a rel="prev" href="{{ previous is defined ? path(route, query|merge({(pageParameterName): previous})) : '#' }}"
  24.        aria-label='{{ 'label_previous'|trans({}, 'KnpPaginatorBundle') }}'
  25.        {% if previous is not defined %}disabled{% endif %}>
  26.        <svg width="6" height="10">
  27.           <use xlink:href='#chevron-small'>
  28.        </svg>
  29.     </a>
  30.     <ul class="show-for-medium">
  31.         {% if startPage > 1 %}
  32.             <li>
  33.                 <a href="{{ path(route, query|merge({(pageParameterName): 1})) }}">1</a>
  34.             </li>
  35.             {% if startPage == 3 %}
  36.                 <li>
  37.                     <a href="{{ path(route, query|merge({(pageParameterName): 2})) }}">2</a>
  38.                 </li>
  39.             {% elseif false and startPage != 2 %}
  40.                 <li class="unavailable">
  41.                     <a>&hellip;</a>
  42.                 </li>
  43.             {% endif %}
  44.         {% endif %}
  45.         {% for page in pagesInRange %}
  46.             {% if page != current %}
  47.                 <li>
  48.                     <a href="{{ path(route, query|merge({(pageParameterName): page})) }}">
  49.                         {{ page }}
  50.                     </a>
  51.                 </li>
  52.             {% else %}
  53.                 <li class="current">
  54.                     <a class="active">{{ page }}</a>
  55.                 </li>
  56.             {% endif %}
  57.         {% endfor %}
  58.         {% if pageCount > endPage %}
  59.             {% if pageCount > (endPage + 1) %}
  60.                 {% if pageCount <= (endPage + 2) %}
  61.                     <li>
  62.                         <a href="{{ path(route, query|merge({(pageParameterName): (pageCount - 1)})) }}">
  63.                             {{ pageCount -1 }}
  64.                         </a>
  65.                     </li>
  66.                 {% elseif false %}
  67.                     <li class="unavailable">
  68.                         <a>&hellip;</a>
  69.                     </li>
  70.                 {% endif %}
  71.             {% endif %}
  72.             <li>
  73.                 <a href="{{ path(route, query|merge({(pageParameterName): pageCount})) }}">{{ pageCount }}</a>
  74.             </li>
  75.         {% endif %}
  76.     </ul>
  77.     <a rel="next" href="{{ next is defined ? path(route, query|merge({(pageParameterName): next })) : '#' }}"
  78.         aria-label="{{ 'label_next'|trans({}, 'KnpPaginatorBundle') }}" class="scale-x--1"
  79.         {% if next is not defined %}disabled{% endif %}>
  80.         <svg width="6" height="10">
  81.             <use xlink:href='#chevron-small'>
  82.         </svg>
  83.     </a>
  84.   </nav>
  85.     
  86.   {% if next is defined %}
  87.   {% set voirplus = app.request.locale == 'fr' ? 'Voir plus' : 'View more' %}
  88.   <div class="pagination pagination--child-links-width-100 auto cell voir-plus">
  89.     <a rel="next" href="{{path( route, query|merge({ (pageParameterName): next }) ) }}" data-load-more>
  90.        {{voirplus}}
  91.     </a>
  92.   </div>
  93.   {% endif %}
  94. </div>
  95. {% endif %}