From: Simon Cozens Date: Tue, 13 Apr 2004 15:43:49 +0000 (+0000) Subject: A pager that doesn't suck when there are 400 pages. X-Git-Tag: 2.10~231 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=52583c3d05f5ceee280e44ad9e6df6759753719c;p=maypole.git A pager that doesn't suck when there are 400 pages. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@131 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/templates/factory/pager b/templates/factory/pager index 0eaa0cb..5f10f59 100644 --- a/templates/factory/pager +++ b/templates/factory/pager @@ -13,7 +13,15 @@ IF pager AND pager.first_page != pager.last_page;

Pages: [% - FOREACH num = [pager.first_page .. pager.last_page]; + SET begin_page = pager.current_page - 10; + IF begin_page < 1; + SET begin_page = pager.first_page; + END; + SET end_page = pager.current_page + 10; + IF pager.last_page < end_page; + SET end_page = pager.last_page; + END; + FOREACH num = [begin_page .. end_page]; IF num == pager.current_page; "["; num; "] "; ELSE;