In this repo i store all my websites, each in a different branch
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

75 wiersze
3.5 KiB

  1. {% spaceless %}
  2. {% if lastPage > 1 %}
  3. {# the number of first and last pages to be displayed #}
  4. {% set extremePagesLimit = 3 %}
  5. {# the number of pages that are displayed around the active page #}
  6. {% set nearbyPagesLimit = 2 %}
  7. {% if currentFilters is not defined %}{% set currentFilters = {} %}{% endif %}
  8. {% if paginationPath is not defined %}{% set paginationPath = app.request.attributes.get('_route') %}{% endif %}
  9. {% if showAlwaysFirstAndLast is not defined %}{% set showAlwaysFirstAndLast = true %}{% endif %}
  10. <!-- Pagination -->
  11. <ul class="pagination justify-content-center mb-4">
  12. {% if currentPage > 1 %}
  13. <li class="page-item">
  14. <a class="page-link" href="page={{ currentPage-1 }}">&larr; Previous page</a>
  15. </li>
  16. {% for i in range(1, extremePagesLimit) if ( i < currentPage - nearbyPagesLimit ) %}
  17. <li class="page-item">
  18. <a class="page-link" href="page={{ i }}">{{ i }}</a>
  19. </li>
  20. {% endfor %}
  21. {% if extremePagesLimit + 1 < currentPage - nearbyPagesLimit %}
  22. <li class="page-item disabled">
  23. <a class="page-link">&hellip;</a>
  24. </li>
  25. {% endif %}
  26. {% for i in range(currentPage-nearbyPagesLimit, currentPage-1) if ( i > 0 ) %}
  27. <li class="page-item">
  28. <a class="page-link" href="page={{ i }}">{{ i }}</a>
  29. </li>
  30. {% endfor %}
  31. {% elseif showAlwaysFirstAndLast %}
  32. <li class="page-item disabled">
  33. <a class="page-link">&larr; Previous page</a>
  34. </li>
  35. {% endif %}
  36. <li class="page-item disabled">
  37. <a class="page-link">{{currentPage }}</a>
  38. </li>
  39. {% if currentPage < lastPage %}
  40. {% for i in range(currentPage+1, currentPage + nearbyPagesLimit) if ( i <= lastPage ) %}
  41. <li class="page-item">
  42. <a class="page-link" href="page={{ i }}">{{ i }}</a>
  43. </li>
  44. {% endfor %}
  45. {% if (lastPage - extremePagesLimit) > (currentPage + nearbyPagesLimit) %}
  46. <li class="page-item disabled">
  47. <a class="page-link">&hellip;</a>
  48. </li>
  49. {% endif %}
  50. {% for i in range(lastPage - extremePagesLimit+1, lastPage) if ( i > currentPage + nearbyPagesLimit ) %}
  51. <li class="page-item">
  52. <a class="page-link" href="page={{ i }}">{{ i }}</a>
  53. </li>
  54. {% endfor %}
  55. <li class="page-item">
  56. <a class="page-link" href="page={{ currentPage+1 }}">Next Page &rarr;</a>
  57. </li>
  58. {% elseif showAlwaysFirstAndLast %}
  59. <li class="page-item disabled">
  60. <a class="page-link">Next Page &rarr;</a>
  61. </li>
  62. {% endif %}
  63. </ul>
  64. {% endif %}
  65. {% endspaceless %}