From 6dd449cc9a7512ee5cfd66aee47e7c6957ee7323 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Sun, 22 Oct 2017 21:04:02 +0200 Subject: [PATCH] Style improvements --- .../submissions/pool/submissions_list.html | 4 +- templates/partials/pagination.html | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 templates/partials/pagination.html diff --git a/submissions/templates/partials/submissions/pool/submissions_list.html b/submissions/templates/partials/submissions/pool/submissions_list.html index 7ce03aa69..addf01aea 100644 --- a/submissions/templates/partials/submissions/pool/submissions_list.html +++ b/submissions/templates/partials/submissions/pool/submissions_list.html @@ -15,8 +15,6 @@ </div> </li> {% empty %} - <li> - <h3 class="text-center">No Submissions found.</h3> - </li> + <li><em>No Submissions found.</em></li> {% endfor %} </ul> diff --git a/templates/partials/pagination.html b/templates/partials/pagination.html new file mode 100644 index 000000000..5a5df28ed --- /dev/null +++ b/templates/partials/pagination.html @@ -0,0 +1,38 @@ +{% load request_filters %} + +<div class="text-center"> + {% if page_obj.has_previous %} + <a class="btn btn-secondary" href="?{% url_replace page=page_obj.previous_page_number %}"><i class="fa fa-long-arrow-left" aria-hidden="true"></i> Previous</a> + {% else %} + <span class="btn btn-secondary text-muted"><i class="fa fa-long-arrow-left" aria-hidden="true"></i> Previous</span> + {% endif %} + + {% if page_obj.number > 1 %} + {% if page_obj.number > 2 %} + <a href="?{% url_replace page=1 %}" class="btn px-1">1</a> + {% if page_obj.number > 3 %} + ... + {% endif %} + {% endif %} + <a href="?{% url_replace page=page_obj.previous_page_number %}" class="btn px-1">{{ page_obj.previous_page_number }}</a> + {% endif %} + + <span class="btn btn-info">{{ page_obj.number }}</span> + + {% if page_obj.number < page_obj.paginator.num_pages %} + <a href="?{% url_replace page=page_obj.next_page_number %}" class="btn px-1">{{ page_obj.next_page_number }}</a> + + {% if page_obj.number|add:"2" < page_obj.paginator.num_pages %} + ... + {% endif %} + {% if page_obj.number|add:"1" < page_obj.paginator.num_pages %} + <a href="?{% url_replace page=page_obj.paginator.num_pages %}" class="btn px-1">{{ page_obj.paginator.num_pages }}</a> + {% endif %} + {% endif %} + + {% if page_obj.has_next %} + <a class="btn btn-secondary" href="?{% url_replace page=page_obj.next_page_number %}">Next <i class="fa fa-long-arrow-right" aria-hidden="true"></i></a> + {% else %} + <span class="btn btn-secondary text-muted">Next <i class="fa fa-long-arrow-right" aria-hidden="true"></i></span> + {% endif %} +</div> -- GitLab