[extensions-web] paginator: Fix ellipsis and last page logic



commit 208fa7c00c4dae46ce0c078baaac22b49cdcbefa
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Dec 8 12:26:55 2011 -0500

    paginator: Fix ellipsis and last page logic

 sweettooth/extensions/templatetags/paginator.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/sweettooth/extensions/templatetags/paginator.py b/sweettooth/extensions/templatetags/paginator.py
index f234a03..fc80d19 100644
--- a/sweettooth/extensions/templatetags/paginator.py
+++ b/sweettooth/extensions/templatetags/paginator.py
@@ -9,7 +9,7 @@ def paginator(page_obj, context=3):
     number = page_obj.number
     num_pages = page_obj.paginator.num_pages
     context_left = range(max(number-context, 2), number)
-    context_right = range(number+1, min(number+context, num_pages))
+    context_right = range(number+1, min(number+context+1, num_pages))
 
     lines = []
 
@@ -28,7 +28,7 @@ def paginator(page_obj, context=3):
         for i in context_right:
             lines.append(u'<a class="next number" href="?page=%d">%d</a>' % (i, i))
 
-        if num_pages - (number+context) > 2:
+        if num_pages - (number+context) > 1:
             lines.append(u'<span class="ellipses">...</span>"')
 
         lines.append(u'<a class="number first" href="?page=%d">%d</a>' % (num_pages, num_pages))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]