[Jifty-commit] r7445 - jifty/trunk/share/web/templates/_elements
Jifty commits
jifty-commit at lists.jifty.org
Tue Aug 25 03:14:31 EDT 2009
Author: sartak
Date: Tue Aug 25 03:14:31 2009
New Revision: 7445
Modified:
jifty/trunk/share/web/templates/_elements/paging
Log:
Tidy
Modified: jifty/trunk/share/web/templates/_elements/paging
==============================================================================
--- jifty/trunk/share/web/templates/_elements/paging (original)
+++ jifty/trunk/share/web/templates/_elements/paging Tue Aug 25 03:14:31 2009
@@ -4,29 +4,63 @@
$per_page => 15
$argument => 'page'
</%args>
-% if ($collection->count != 0) {
+<%init>
+return if $collection->count == 0;
+
+$page ||= 1;
+my $last = $collection->pager->last_page;
+</%init>
+
<div class="paging-nav">
Page <span class="paging-numbers">
-% my $last = $collection->pager->last_page;
% my $last_num = 0;
% foreach my $goto_page (1 .. $last) {
% # only show page numbers that are: 1, (within 3 of the current page), last
% next if (($goto_page > 1) && ($goto_page < $last) && (abs($goto_page-$page) > 2));
-% if ( ($goto_page - $last_num) > 1) {
+% if ( ($goto_page - $last_num) > 1) {
…
-% }
-<span class="paging-number <%$goto_page == $page ? 'current' : ''%>"><% Jifty->web->link( label => $goto_page, onclick => { args => { $argument => $goto_page } } ) %></span>
+% }
+<span class="paging-number <%$goto_page == $page ? 'current' : ''%>">
+ <% Jifty->web->link(
+ label => $goto_page,
+ onclick => {
+ args => {
+ $argument => $goto_page,
+ },
+ },
+ ) %>
+</span>
% $last_num = $goto_page;
% }
% if ($collection->pager->previous_page) {
-<span class="paging-prev"><% Jifty->web->link( label => "Back", class => "prev", onclick => { args => { $argument => $collection->pager->previous_page } } ) %></span>
+<span class="paging-prev">
+ <% Jifty->web->link(
+ label => "Back",
+ class => "prev",
+ onclick => {
+ args => {
+ $argument => $collection->pager->previous_page,
+ },
+ },
+ ) %>
+</span>
% }
% if ($collection->pager->next_page) {
-<span class="paging-next"><% Jifty->web->link( label => "Next", class => "next", onclick => { args => { $argument => $collection->pager->next_page } } ) %></span>
+<span class="paging-next">
+ <% Jifty->web->link(
+ label => "Next",
+ class => "next",
+ onclick => {
+ args => {
+ $argument => $collection->pager->next_page,
+ },
+ },
+ ) %>
+</span>
% }
+
</span>
</div>
-% }
More information about the Jifty-commit
mailing list