Skip to content

Commit

Permalink
More enabling of the per_page parameter
Browse files Browse the repository at this point in the history
Bumps #368
  • Loading branch information
lomky committed Jan 3, 2018
1 parent 4998449 commit 7f67e24
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Tuba/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use Tuba::DB::Objects qw/-nicknames/;
sub list {
my $c = shift;
return $c->reply->not_found;
$c->stash(objects => Files->get_objects(with_objects => 'publications', page => $c->page));
$c->stash(objects => Files->get_objects(with_objects => 'publications', page => $c->page, per_page => $c->per_page));
my $count = Files->get_objects_count;
$c->set_pages($count);
$c->SUPER::list(@_);
Expand Down
2 changes: 1 addition & 1 deletion lib/Tuba/Finding.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sub list {
my $meta = Finding->meta;
my $report_identifier = $c->stash('report_identifier');
my $all = $c->param('all');
my @page = $all ? () : (page => $c->page);
my @page = $all ? () : (page => $c->page, per_page => $c->per_page);

if (my $chapter = $c->stash('chapter')) {
$objects = Findings->get_objects(
Expand Down
2 changes: 1 addition & 1 deletion lib/Tuba/Organization.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sub list {
if ($c->param('all')) {
$c->stash(objects => Organizations->get_objects(@q));
} else {
$c->stash(objects => scalar Organizations->get_objects(@q, sort_by => 'name', page => $c->page));
$c->stash(objects => scalar Organizations->get_objects(@q, sort_by => 'name', page => $c->page, per_page => $c->per_page));
$c->set_pages(Organizations->get_objects_count(@q));
}
$c->SUPER::list(@_);
Expand Down
2 changes: 1 addition & 1 deletion lib/Tuba/Person.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sub list {
if ($c->param('all')) {
$c->stash(objects => Persons->get_objects(@q));
} else {
$c->stash(objects => scalar Persons->get_objects(@q, sort_by => 'last_name, first_name', page => $c->page));
$c->stash(objects => scalar Persons->get_objects(@q, sort_by => 'last_name, first_name', page => $c->page, per_page => $c->per_page));
$c->set_pages(Persons->get_objects_count(@q));
}
$c->SUPER::list(@_);
Expand Down
9 changes: 7 additions & 2 deletions lib/Tuba/Region.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ sub list {
$objects = Regions->get_objects(
query => [ publication_id => $publication->id ],
with_objects => [qw/publications/],
page => $c->page
page => $c->page,
per_page => $c->per_page
);
$count = Regions->get_objects_count(
query => [ publication_id => $publication->id ],
with_objects => [qw/publications/],
);
}
else {
$objects = Regions->get_objects(with_objects => 'publications', page => $c->page);
$objects = Regions->get_objects(
with_objects => 'publications',
page => $c->page,
per_page => $c->per_page
);
$count = Regions->get_objects_count;
}
$c->stash(objects => $objects);
Expand Down
2 changes: 1 addition & 1 deletion lib/Tuba/Table.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sub list {
my $tables;
my $report_identifier = $c->stash('report_identifier');
my $all = $c->param('all');
my @page = $all ? () : (page => $c->page);
my @page = $all ? () : (page => $c->page, per_page => $c->per_page);
if (my $ch = $c->stash('chapter')) {
$tables = Tables->get_objects(
query => [chapter_identifier => $ch->identifier, report_identifier => $report_identifier], with_objects => ['chapter'],
Expand Down

0 comments on commit 7f67e24

Please sign in to comment.