From af40bbffb8c2bda4341e89f95f3a139b8e7da0c4 Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Tue, 7 Feb 2017 13:07:45 +0100 Subject: [PATCH] separate pagination logic for categories and announces (#14906) --- corbo/templates/corbo/announce_list.html | 30 +----------------------------- corbo/templates/corbo/manage.html | 28 +--------------------------- corbo/templates/corbo/paginator.html | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 56 deletions(-) create mode 100644 corbo/templates/corbo/paginator.html diff --git a/corbo/templates/corbo/announce_list.html b/corbo/templates/corbo/announce_list.html index 22d148f..890374d 100644 --- a/corbo/templates/corbo/announce_list.html +++ b/corbo/templates/corbo/announce_list.html @@ -38,35 +38,7 @@ {% endfor %} -{% if is_paginated %} -

- {% if page_obj.number > 1 %} - {% if page_obj.previous_page_number != 1 %} - 1 - ... - {% endif %} - {% endif %} - - {% if page_obj.has_previous %} - {{ page_obj.previous_page_number }} - {% endif %} - - {{ page_obj.number }} - - {% if page_obj.has_next %} - {{ page_obj.next_page_number }} - {% endif %} - - {% if page_obj.number != page_obj.paginator.num_pages %} - {% if page_obj.paginator.num_pages > 1 %} - {% if page_obj.next_page_number != page_obj.paginator.num_pages %} - ... - {{ page_obj.paginator.num_pages }} - {% endif %} - {% endif %} - {% endif %} -

-{% endif %} +{% include "corbo/paginator.html" %} {% else %}
diff --git a/corbo/templates/corbo/manage.html b/corbo/templates/corbo/manage.html index aeffae6..12757b7 100644 --- a/corbo/templates/corbo/manage.html +++ b/corbo/templates/corbo/manage.html @@ -28,33 +28,7 @@ {% endfor %} -{% if is_paginated %} -

- {% if page_obj.number > 1 %} - {% if page_obj.previous_page_number != 1 %} - 1 - ... - {% endif %} - {% endif %} - {% if page_obj.has_previous %} - {{ page_obj.previous_page_number }} - {% endif %} - - {{ page_obj.number }} - - {% if page_obj.has_next %} - {{ page_obj.next_page_number }} - {% endif %} - {% if page_obj.number != page_obj.paginator.num_pages %} - {% if page_obj.paginator.num_pages > 1 %} - {% if page_obj.next_page_number != page_obj.paginator.num_pages %} - ... - {{ page_obj.paginator.num_pages }} - {% endif %} - {% endif %} - {% endif %} -

-{% endif %} + {% include "corbo/paginator.html" %} {% else %}
diff --git a/corbo/templates/corbo/paginator.html b/corbo/templates/corbo/paginator.html new file mode 100644 index 0000000..9171497 --- /dev/null +++ b/corbo/templates/corbo/paginator.html @@ -0,0 +1,29 @@ +{% if is_paginated %} +

+ {% if page_obj.number > 1 %} + {% if page_obj.previous_page_number != 1 %} + 1 + ... + {% endif %} + {% endif %} + + {% if page_obj.has_previous %} + {{ page_obj.previous_page_number }} + {% endif %} + + {{ page_obj.number }} + + {% if page_obj.has_next %} + {{ page_obj.next_page_number }} + {% endif %} + + {% if page_obj.number != page_obj.paginator.num_pages %} + {% if page_obj.paginator.num_pages > 1 %} + {% if page_obj.next_page_number != page_obj.paginator.num_pages %} + ... + {{ page_obj.paginator.num_pages }} + {% endif %} + {% endif %} + {% endif %} +

+{% endif %} -- 2.11.0