Merge branch 'master' of ssh://s.mdrn.pl:2224/srv/redakcja.wolnelektury.pl/git
[redakcja.git] / src / redakcja / templates / pagination / pagination.html
old mode 100755 (executable)
new mode 100644 (file)
index fe566a8..6aa12ad
@@ -1,26 +1,53 @@
 {% if is_paginated %}
 {% load i18n %}
 {% if is_paginated %}
 {% load i18n %}
-<div class="pagination">
+<nav aria-label="{% trans 'Pagination' %}" class="mt-4">
+  <ul class="pagination justify-content-center">
     {% if page_obj.has_previous %}
     {% if page_obj.has_previous %}
-        <a href="?page={{ page_obj.previous_page_number }}{{ getvars }}{{ hashtag }}" class="prev">&lsaquo;&lsaquo; {% trans "previous" %}</a>
+      <li class="page-item">
+        <a href="?page={{ page_obj.previous_page_number }}{{ getvars }}{{ hashtag }}" class="page-link">
+          {% trans "previous" %}
+        </a>
+      </li>
     {% else %}
     {% else %}
-        <span class="disabled prev">&lsaquo;&lsaquo; {% trans "previous" %}</span>
+      <li class="page-item disabled">
+        <span class="page-link">
+          {% trans "previous" %}
+        </span>
+      </li>
+    {% endif %}
+
+      {% for page in pages %}
+      {% if page %}
+      {% if page == page_obj.number %}
+    <li class="page-item active">
+      <span class="page-link">
+        {{ page }}
+      </span>
+    </li>
+    {% else %}
+    <li class="page-item">
+      <a href="?page={{ page }}{{ getvars }}{{ hashtag }}" class="page-link">
+        {{ page }}
+        </a>
+    </li>
+    {% endif %}
     {% endif %}
     {% endif %}
-    {% for page in pages %}
-        {% if page %}
-            {% ifequal page page_obj.number %}
-                <span class="current page">{{ page }}</span>
-            {% else %}
-                <a href="?page={{ page }}{{ getvars }}{{ hashtag }}" class="page">{{ page }}</a>
-            {% endifequal %}
-        {% else %}
-            ...
-        {% endif %}
     {% endfor %}
     {% endfor %}
+
     {% if page_obj.has_next %}
     {% if page_obj.has_next %}
-        <a href="?page={{ page_obj.next_page_number }}{{ getvars }}{{ hashtag }}" class="next">{% trans "next" %} &rsaquo;&rsaquo;</a>
+      <li class="page-item">
+        <a href="?page={{ page_obj.next_page_number }}{{ getvars }}{{ hashtag }}" class="page-link">
+          {% trans "next" %}
+        </a>
+      </li>
     {% else %}
     {% else %}
-        <span class="disabled next">{% trans "next" %} &rsaquo;&rsaquo;</span>
+      <li class="page-item disabled">
+        <span class="page-link">
+          {% trans "next" %}
+        </span>
+      </li>
     {% endif %}
     {% endif %}
-</div>
+  </ul>
+</nav>
+
 {% endif %}
 {% endif %}