From b432b674feaf61e2539d6db4de44079c94c11420 Mon Sep 17 00:00:00 2001 From: chimchooree Date: Sun, 4 Oct 2020 10:21:49 -0500 Subject: [PATCH] commented python diary nav code --- src/views/diary.tpl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/views/diary.tpl b/src/views/diary.tpl index c531fa8..1e4f7c1 100644 --- a/src/views/diary.tpl +++ b/src/views/diary.tpl @@ -5,43 +5,56 @@
% max_pages = int((total - 1) / limit) % cluster = 3 + % # TRY DECIMAL POINT PAGES <% + # page never below 0 if page <= 0: page = 0 end + # page never over maximum if page > max_pages: page = max_pages end %> + % # << is always active link pointing to 0 << + % # < points to 0 if page 0 or below % if page <= 0: < + % # < points to previous page otherwise % else: < % end + % # form cluster of number links around page % for i in range(max(0,page - cluster), min(max_pages + 1,page + cluster + 1)): + % # bold current page number % if i == page: {{i}} + % # form neighboring numbers into links % else: {{i}} % end % end + % # fill out number cluster to the right when page is low % if page <= 2 and max_pages > page + 3: % for j in range(cluster - page): {{page + j + cluster + 1}} % end % end + % # > points to max if page is at or above maximum % if page >= max_pages: > + % # > point to next page otherwise % else: > % end + % # >> is always active link to maximum page >>