[Catalyst-commits] r9401 - in trunk/Catalyst-Example-InstantCRUD: . lib/Catalyst/Example lib/Catalyst/Helper/View

zby at dev.catalyst.perl.org zby at dev.catalyst.perl.org
Sat Feb 28 10:08:42 GMT 2009


Author: zby
Date: 2009-02-28 10:08:42 +0000 (Sat, 28 Feb 2009)
New Revision: 9401

Modified:
   trunk/Catalyst-Example-InstantCRUD/Changes
   trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/InstantCRUD.pm
   trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Helper/View/InstantCRUD.pm
Log:
better pager

Modified: trunk/Catalyst-Example-InstantCRUD/Changes
===================================================================
--- trunk/Catalyst-Example-InstantCRUD/Changes	2009-02-27 20:38:34 UTC (rev 9400)
+++ trunk/Catalyst-Example-InstantCRUD/Changes	2009-02-28 10:08:42 UTC (rev 9401)
@@ -1,5 +1,7 @@
 Revision history for Catalyst-Example-InstantCRUD
 
+
+0.0.30 Sat Feb 28 11:15:15 CET 2009 Better pager
 0.0.29 Thu Feb 26 21:19:55 CET 2009 UTF-8
 
 

Modified: trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/InstantCRUD.pm
===================================================================
--- trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/InstantCRUD.pm	2009-02-27 20:38:34 UTC (rev 9400)
+++ trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Example/InstantCRUD.pm	2009-02-28 10:08:42 UTC (rev 9401)
@@ -1,6 +1,6 @@
 package Catalyst::Example::InstantCRUD;
 
-use version; $VERSION = qv('0.0.29');
+use version; $VERSION = qv('0.0.30');
 
 use warnings;
 use strict;
@@ -19,7 +19,7 @@
 
 =head1 VERSION
 
-This document describes Catalyst::Example::InstantCRUD version 0.0.29
+This document describes Catalyst::Example::InstantCRUD version 0.0.30
 
 =head1 SYNOPSIS
 

Modified: trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Helper/View/InstantCRUD.pm
===================================================================
--- trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Helper/View/InstantCRUD.pm	2009-02-27 20:38:34 UTC (rev 9400)
+++ trunk/Catalyst-Example-InstantCRUD/lib/Catalyst/Helper/View/InstantCRUD.pm	2009-02-28 10:08:42 UTC (rev 9401)
@@ -1,6 +1,6 @@
 package Catalyst::Helper::View::InstantCRUD;
 
-use version; $VERSION = qv('0.0.6');
+use version; $VERSION = qv('0.0.7');
 
 use warnings;
 use strict;
@@ -241,19 +241,36 @@
 <hr>
 [% form.html_table %]
 __pager__
-<div id="pager">
-Results: [% pager.first %] to [% pager.last %] from [% pager.total_entries %]<br />
-[%  IF pager.last_page > 1 %]
-[%-     FOR page = [ pager.first_page .. pager.last_page ] -%]
-[%-         IF page == pager.current_page -%]
-<b>[%-          page -%]</b>
-[%-         ELSE -%]
-<a href="[% c.request.uri_with( 'page' => page )%]">[% page %]</a>
-[%-         END -%]
-&nbsp;
-[%      END -%]
-[%- END -%]
+[% IF pager %]
+<div class="pager">
+    <div class="counter">
+        Page [% pager.current_page %] of [% pager.last_page %]
+    </div>
+    <div>
+       [% IF pager.previous_page %]
+           <span><a href="[% c.req.uri_with( page => pager.first_page ) %]">&laquo;</a></span>
+           <span><a href="[% c.req.uri_with( page => pager.previous_page ) %]">&lt;</a></span>
+       [% END %]
+
+       [%  
+           start = (pager.current_page - 3) > 0               ? (pager.current_page - 3) : 1;
+           end   = (pager.current_page + 3) < pager.last_page ? (pager.current_page + 3) : pager.last_page;
+           FOREACH page IN [ start .. end  ]
+       %] 
+           [% IF pager.current_page == page %]
+               <span class="current"> [% page %] </span>
+           [% ELSE %]
+               <span> <a href="[% c.req.uri_with( page => page ) %]">[% page %]</a> </span>
+           [% END %]
+       [% END %]
+
+       [% IF pager.next_page %]
+           <span><a href="[% c.req.uri_with( page => pager.next_page ) %]">&gt;</a></span>
+           <span><a href="[% c.req.uri_with( page => pager.last_page ) %]">&raquo;</a></span>
+       [% END %]
+   </div>
 </div>
+[% END %]
 
 __destroy__
 [% destroywidget %]
@@ -905,8 +922,8 @@
 =head1 AUTHOR
 
 <Zbigniew Lukasiak>  C<< <<zz bb yy @ gmail.com>> >>
+Paginator adapted from example by Oliver Charles.
 
-
 =head1 LICENCE AND COPYRIGHT
 
 Copyright (c) 2005, <Zbigniew Lukasiak> C<< <<zz bb yy @ gmail.com>> >>. All rights reserved.




More information about the Catalyst-commits mailing list