app/template/default/pager.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {# style #}
  9. <style>
  10.     .ec-pager {
  11.         padding-top: 80px;
  12.     }
  13.     .ec-pager__item {
  14.         background: rgba(0, 0, 0, 0.05) !important;
  15.         border-radius: 8px;
  16.     }
  17.     .ec-pager__item--active {
  18.         border-radius: 8px;
  19.         background: var(--color-primary) !important;
  20.         color: #FFFFFF;
  21.     }
  22.     .ec-pager__item--disabled {
  23.         opacity: 0.5;
  24.         pointer-events: none;
  25.     }
  26.     .ec-pager__item--prev {
  27.         margin-right: 92px;
  28.     }
  29.     .ec-pager__item--next {
  30.         margin-left: 92px;
  31.     }
  32.     @media (max-width: 768px) {
  33.         .ec-pager__item--prev {
  34.             margin-right: 0;
  35.         }
  36.         .ec-pager__item--next {
  37.             margin-left: 0;
  38.         }
  39.     }
  40.     .ec-pager .ec-pager__item a, .ec-pager .ec-pager__item--active a {
  41.         padding: 7px 13px;
  42.     }
  43. </style>
  44. {% if pages.pageCount > 1 %}
  45.     <ul class="ec-pager">
  46.         {# 最初へ #}
  47.         {% if pages.firstPageInRange != 1 %}
  48.             <li class="ec-pager__item">
  49.                 <a href="{{ path(
  50.                 app.request.attributes.get('_route'),
  51.                 app.request.query.all|merge({'pageno': pages.first})) }}">
  52.                     <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  53.                     <path d="M3 0.514648L3 11.4854" stroke="#353535" stroke-width="1.35"/>
  54.                     <path d="M9.90367 0.908831L6.84897 3.96353C5.72426 5.08824 5.72426 6.91176 6.84897 8.03647L9.90367 11.0912" stroke="#353535" stroke-width="1.35"/>
  55.                     </svg>
  56.                 </a>
  57.             </li>
  58.         {% endif %}
  59.         {# 前へ #}
  60.         {% if pages.previous is defined %}
  61.             <li class="ec-pager__item ec-pager__item--prev">
  62.                 <a href="{{ path(
  63.                 app.request.attributes.get('_route'),
  64.                 app.request.query.all|merge({'pageno': pages.previous})) }}">
  65.                     <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  66.                         <path d="M7.88804 0.993792L4.83334 4.04849C3.70863 5.1732 3.70863 6.99672 4.83334 8.12143L7.88804 11.1761" stroke="#353535" stroke-width="1.35"/>
  67.                     </svg>
  68.                 </a></li>
  69.             {% else %}
  70.                 <li class="ec-pager__item ec-pager__item--prev ec-pager__item--disabled">
  71.                     <a href="#">
  72.                         <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  73.                             <path d="M7.88804 0.993792L4.83334 4.04849C3.70863 5.1732 3.70863 6.99672 4.83334 8.12143L7.88804 11.1761" stroke="#353535" stroke-width="1.35"/>
  74.                         </svg>
  75.                     </a>
  76.                 </li>
  77.         {% endif %}
  78.         {# 1ページリンクが表示されない場合、「...」を表示 #}
  79.         {% if pages.firstPageInRange != 1 %}
  80.             <li class="ec-pager__item">...</li>
  81.         {% endif %}
  82.         {% for page in pages.pagesInRange %}
  83.             {% if page == pages.current %}
  84.                 <li class="ec-pager__item--active"><a href="{{ path(
  85.                     app.request.attributes.get('_route'),
  86.                     app.request.query.all|merge({'pageno': page})) }}"> {{ page }} </a></li>
  87.             {% else %}
  88.                 <li class="ec-pager__item"><a href="{{ path(
  89.                     app.request.attributes.get('_route'),
  90.                     app.request.query.all|merge({'pageno': page})) }}"> {{ page }} </a></li>
  91.             {% endif %}
  92.         {% endfor %}
  93.         {# 最終ページリンクが表示されない場合、「...」を表示 #}
  94.         {% if pages.last != pages.lastPageInRange %}
  95.             <li class="ec-pager__item">...</li>
  96.         {% endif %}
  97.         {# 次へ #}
  98.         {% if pages.next is defined %}
  99.             <li class="ec-pager__item ec-pager__item--next">
  100.                 <a href="{{ path(
  101.                 app.request.attributes.get('_route'),
  102.                 app.request.query.all|merge({'pageno': pages.next})) }}">
  103.                     <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  104.                         <path d="M4.11196 0.993792L7.16666 4.04849C8.29137 5.1732 8.29137 6.99672 7.16666 8.12143L4.11196 11.1761" stroke="#353535" stroke-width="1.35"/>
  105.                     </svg>
  106.                 </a></li>
  107.             {% else %}
  108.                 <li class="ec-pager__item ec-pager__item--next ec-pager__item--disabled">
  109.                     <a href="#">
  110.                         <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  111.                             <path d="M4.11196 0.993792L7.16666 4.04849C8.29137 5.1732 8.29137 6.99672 7.16666 8.12143L4.11196 11.1761" stroke="#353535" stroke-width="1.35"/>
  112.                         </svg>
  113.                     </a>
  114.                 </li>
  115.         {% endif %}
  116.         {# 最後へ #}
  117.         {% if pages.last != pages.lastPageInRange %}
  118.             <li class="ec-pager__item">
  119.                 <a href="{{ path(
  120.                 app.request.attributes.get('_route'),
  121.                 app.request.query.all|merge({'pageno': pages.last})) }}">
  122.                     <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
  123.                     <path d="M9 0.514648L9 11.4854" stroke="#353535" stroke-width="1.35"/>
  124.                     <path d="M2.09633 0.908831L5.15103 3.96353C6.27574 5.08824 6.27574 6.91176 5.15103 8.03647L2.09633 11.0912" stroke="#353535" stroke-width="1.35"/>
  125.                     </svg>
  126.                 </a></li>
  127.         {% endif %}
  128.     </ul>
  129. {% endif %}