haikal/templates/partials/pagination.html
Marwan Alwali b22ef36524 update
2025-07-01 18:29:31 +03:00

64 lines
2.8 KiB
HTML

{% load i18n static %}
<div class="d-flex justify-content-between align-items-center mt-4 mb-3">
<div class="text-body-secondary fw-bold fs-10">
{{ _("Showing") }} {{ page_obj.start_index }} {{ _("to") }} {{ page_obj.end_index }}
{{ _("of") }} {{ page_obj.paginator.count }} {{ _("results") }}
</div>
<nav aria-label="Page navigation">
<ul class="pagination mb-0">
{# First Page Link #}
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page=1{% if q %}&q={{q}}{% endif %}">
<span class="fas fa-angle-double-{% if LANGUAGE_CODE == 'ar' %}right{% else %}left{% endif %}"> </span>
</a>
</li>
{% else %}
<li class="page-item">
<span class="page-link">
<span class="fas fa-chevron-{% if LANGUAGE_CODE == 'ar' %}right{% else %}left{% endif %}"> </span>
</span>
</li>
{% endif %}
{# Previous Page Link #}
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if q %}&q={{q}}{% endif %}">
<span class="fas fa-chevron-{% if LANGUAGE_CODE == 'ar' %}right{% else %}left{% endif %}"></span>
</a>
</li>
{% endif %}
{# Page Numbers #}
{% for num in page_obj.paginator.page_range %}
{% if num == 1 or num == page_obj.paginator.num_pages or num >= page_obj.number|add:-2 and num <= page_obj.number|add:2 %}
<li class="page-item {% if num == page_obj.number %}active{% endif %}">
<a class="page-link" {% if num == page_obj.number %}aria-current="page"{% endif %}
href="?page={{ num }}{% if q %}&q={{q}}{% endif %}">
{{ num }}
</a>
</li>
{% endif %}
{% endfor %}
{# Next Page Link #}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% if q %}&q={{q}}{% endif %}">
<span class="fas fa-chevron-{% if LANGUAGE_CODE == 'ar' %}left{% else %}right{% endif %}"></span>
</a>
</li>
{% endif %}
{# Last Page Link #}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}{% if q %}&q={{q}}{% endif %}">
<span class="fas fa-angle-double-{% if LANGUAGE_CODE == 'ar' %}left{% else %}right{% endif %}"></span>
</a>
</li>
{% endif %}
</ul>
</nav>
</div>