59 lines
3.1 KiB
HTML
59 lines
3.1 KiB
HTML
|
|
{% load url_extras i18n %}
|
|
{% if page_obj.has_other_pages %}
|
|
<nav aria-label="Page navigation" class="mt-4">
|
|
<ul class="pagination justify-content-center">
|
|
|
|
{# Get the filter parameters (e.g., "q=searchterm&job=dev") #}
|
|
{% add_get_params request.GET as filter_params %}
|
|
|
|
{# Define the & prefix logic inline to avoid custom tags #}
|
|
{% if filter_params %}{% if "?" in request.get_full_path or "page" in request.get_full_path %}{% endif %}{% endif %}
|
|
|
|
{# --- First & Previous --- #}
|
|
{% if page_obj.has_previous %}
|
|
<li class="page-item">
|
|
<a class="page-link text-primary-theme" href="?page=1{% if filter_params %}&{{ filter_params }}{% endif %}">
|
|
<i class="fas fa-angle-double-left"></i>
|
|
</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link text-primary-theme" href="?page={{ page_obj.previous_page_number }}{% if filter_params %}&{{ filter_params }}{% endif %}">
|
|
<i class="fas fa-angle-left"></i>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
{# --- Page Numbers --- #}
|
|
{# --- Page Numbers --- #}
|
|
{% for num in page_obj.paginator.page_range %}
|
|
{% if page_obj.number == num %}
|
|
<li class="page-item active"><span class="page-link bg-kaauh-teal text-white border-kaauh-teal">{{ num }}</span></li>
|
|
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
|
|
<li class="page-item"><a class="page-link text-primary-theme" href="?page={{ num }}{% if filter_params %}&{{ filter_params }}{% endif %}">{{ num }}</a></li>
|
|
{% elif num == 1 or num == page_obj.paginator.num_pages %}
|
|
{# Optional: Always show first and last page number #}
|
|
<li class="page-item"><a class="page-link text-primary-theme" href="?page={{ num }}{% if filter_params %}&{{ filter_params }}{% endif %}">{{ num }}</a></li>
|
|
{% elif num == page_obj.number|add:'-3' or num == page_obj.number|add:'3' %}
|
|
{# Show the dots #}
|
|
<li class="page-item disabled"><span class="page-link">...</span></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{# --- Next & Last --- #}
|
|
{% if page_obj.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link text-primary-theme" href="?page={{ page_obj.next_page_number }}{% if filter_params %}&{{ filter_params }}{% endif %}">
|
|
<i class="fas fa-angle-right"></i>
|
|
</a>
|
|
</li>
|
|
<li class="page-item">
|
|
<a class="page-link text-primary-theme" href="?page={{ page_obj.paginator.num_pages }}{% if filter_params %}&{{ filter_params }}{% endif %}">
|
|
<i class="fas fa-angle-double-right"></i>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
</ul>
|
|
</nav>
|
|
{% endif %} |