--- lib/Arh/View/Units.pm 2008/04/07 17:50:53 65 +++ lib/Arh/View/Units.pm 2008/04/08 21:34:16 66 @@ -10,6 +10,8 @@ sub object_type { 'Unit' }; +sub per_page { get('per_page') || 5 }; + sub display_columns { my $self = shift; return ( qw/ @@ -56,6 +58,31 @@ #private template search_region => sub {}; +private template 'paging_top' => sub { + my $self = shift; + my $collection = shift; + my $page = shift || 1; + + if ( $collection->pager->last_page > 1 ) { + span { + { class is 'page-count' }; + outs( + _( "Found %1 units, showing %2-%3 on page %4/%5", + $collection->pager->total_entries, + $collection->pager->first, + $collection->pager->last, + $page, + $collection->pager->last_page + ) + ); + } + } + + show( './paging_bottom', $collection, $page ); + +}; + + template 'view' => sub :CRUDView { my $self = shift; my $id = get('id'); @@ -140,9 +167,9 @@ my $self = shift; return unless $self->current_user->editing; - my ( $object_type, $id ) = ( $self->object_type, get('id') ); - my $record_class = $self->record_class; - my $create = $record_class->as_create_action; + my ( $object_type, $id ) = ( $self->object_type, get('id') ); + my $record_class = $self->record_class; + my $create = $record_class->as_create_action; h1 { _("New unit") };