/[Arh]/lib/Arh/View/Units.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Arh/View/Units.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 69 by dpavlin, Tue Apr 8 23:38:42 2008 UTC revision 77 by dpavlin, Fri Apr 18 16:17:31 2008 UTC
# Line 11  use Data::Dump qw/dump/; Line 11  use Data::Dump qw/dump/;
11  sub object_type { 'Unit' };  sub object_type { 'Unit' };
12    
13  sub per_page {  sub per_page {
14          my $per_page = get('per_page') || 5;          my $per_page = get('per_page') || 3;
15          warn "## Units per_page = $per_page\n";          warn "## Units per_page = $per_page\n";
16          return $per_page;          return $per_page;
17  };  };
# Line 126  private template 'paging_top' => sub { Line 126  private template 'paging_top' => sub {
126          show( './paging_bottom', $collection, $page );          show( './paging_bottom', $collection, $page );
127  };  };
128    
129    private template paging_bottom => sub {
130            my $self           = shift;
131            my $collection = shift;
132            my $page           = shift || 0;
133            div {
134                    { class is 'paging' };
135                    if ( $collection->pager->previous_page ) {
136                            span {
137                                    hyperlink(
138                                            label   => _("Previous Page"),
139                                            onclick => {
140                                                    args => { page => $collection->pager->previous_page }
141                                            }
142                                    );
143                            }
144                    }
145    
146                    my ( $f_p, $t_p ) = ( '...', '...' );
147    
148                    my $from = $page - 15;
149                    if ( $from < 0 ) {
150                            $from = $collection->pager->first_page;
151                            $f_p = '';
152                    }
153                    my $to = $page + 15;
154                    if ( $to > $collection->pager->last_page ) {
155                            $to = $collection->pager->last_page;
156                            $t_p = '';
157                    }
158    
159                    outs $f_p;
160    
161                    foreach my $p ( $from .. $to ) {
162                            if ( $p == $page ) {
163                                    b { $p }
164                            } else {
165                                    span {
166                                            hyperlink(
167                                                    label   => $p,
168                                                    onclick =>
169                                                            { args => { page => $p } }
170                                            );
171                                    }
172                            }
173                    }
174    
175                    outs $t_p;
176    
177                    if ( $collection->pager->next_page ) {
178                            span {
179                                    hyperlink(
180                                            label   => _("Next Page"),
181                                            onclick =>
182                                                    { args => { page => $collection->pager->next_page } }
183                                    );
184                            }
185                    }
186            };
187    };
188    
189    
190  template 'view' => sub :CRUDView {  template 'view' => sub :CRUDView {
191          my $self   = shift;          my $self   = shift;

Legend:
Removed from v.69  
changed lines
  Added in v.77

  ViewVC Help
Powered by ViewVC 1.1.26