[Koha-bugs] [Bug 19196] Add pagination helpers
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Aug 31 01:04:14 CEST 2017
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19196
Tomás Cohen Arazi <tomascohen at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #66610|0 |1
is obsolete| |
--- Comment #8 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 66657
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66657&action=edit
Bug 19196: Add Koha::REST::Plugin::Pagination
This patch introduces a Mojolicious plugin to be used on the REST api.
It adds a helper method:
add_pagination_headers
======================
When used, it adds a _Link_ header to the reponse with the calculated
values for pagination, and X-Total-Count containing the total results
like this:
my $params = $c->validation->output;
my $patrons = Koha::Patrons->search;
my $count = $patrons->count;
$c->add_pagination_headers({
total => $count,
page => $params->{page},
per_page => $params->{per_page} });
To test:
- Run:
$ sudo koha-shell kohadev
k$ cd kohaclone
k$ prove t/Koha/REST/Plugin/Pagination.t
=> SUCCESS: Tests pass!
- Sign off :-D
Sponsored-by: ByWater solutions
Sponsored-by: Camden County
lib
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list