Commit c6c17772 authored by BERJON Matthieu's avatar BERJON Matthieu

Refactor of pagination

I put the pagination system in its own template and include it wherever
necessary.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent 96805d32
......@@ -32,37 +32,5 @@
<p>No current job history available.</p>
{% endif %}
{% if is_paginated %}
<nav aria-label="Webapp page navigation">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">Previous</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">Previous</a>
</li>
{% endif %}
{% for page in page_obj.paginator.page_range %}
{% if page == page_obj.number %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">{{ page }}</a>
</li>
{% else %}
<li class="page_item"><a class="page-link" href="?page={{ page }}">{{ page }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">Next</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% include "partials/_pagination.html" %}
{% endblock %}
{% if is_paginated %}
<nav aria-label="Webapp page navigation">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">Previous</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">Previous</a>
</li>
{% endif %}
{% for page in page_obj.paginator.page_range %}
{% if page == page_obj.number %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">{{ page }}</a>
</li>
{% else %}
<li class="page_item"><a class="page-link" href="?page={{ page }}">{{ page }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">Next</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
......@@ -26,37 +26,5 @@
{% endfor %}
</div>
{% if is_paginated %}
<nav aria-label="Webapp page navigation">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">Previous</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">Previous</a>
</li>
{% endif %}
{% for page in page_obj.paginator.page_range %}
{% if page == page_obj.number %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">{{ page }}</a>
</li>
{% else %}
<li class="page_item"><a class="page-link" href="?page={{ page }}">{{ page }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">Next</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% include "partials/_pagination.html" %}
{% endblock %}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment