Created
July 12, 2012 04:14
-
-
Save rumidier/3095682 to your computer and use it in GitHub Desktop.
List - index_action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub index :Path :Args(0) { | |
my ( $self, $c ) = @_; | |
my %attr = ( 'order_by' => { -desc => 'me.id' } ); | |
my $rs; | |
my %cond = (); | |
my $page = $c->req->params->{page}; | |
my $status = $c->req->param("status") || $c->stash->{"status"} || '0'; #수정 필요 | |
$attr{page} = $page || 1; | |
%cond = ( status => $status ) if $status; | |
$rs = $c->model('DonDB')->resultset('Charge')->search(\%cond, \%attr); | |
my $page_info = | |
Data::Pageset->new( | |
{ | |
( map { $_ => $rs->pager->$_ } qw/entries_per_page total_entries current_page/ ), | |
mode => "slide", | |
pages_per_set => 10, | |
} | |
); | |
$c->stash( | |
lists => [ $rs->all ], | |
status => $status, | |
pageset => $page_info, | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment