https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19196
Tomás Cohen Arazi <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #66600|0 |1 is obsolete| | --- Comment #5 from Tomás Cohen Arazi <[email protected]> --- Created attachment 66610 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=66610&action=edit Bug 19196: Add Koha::REST::Plugin::Pagination This patch introduces a Mojolicious plugin to be used on the REST api. It adds two helper methods: total_count_header ================== When used, it adds an _X-Total-Count_ header with the value it got passed like this: my $patrons = Koha::Patrons->search; my $count = $patrons->count; $c->total_count_header({ total => $count }); => Response contains X-Total-Count: $count links_header ============ When used, it adds a _Link_ header to the reponse with the calculated values for pagination, like this: my $patrons = Koha::Patrons->search; my $count = $patrons->count; $c->links_header({ total => $count, page => 2, per_page => 2 }); 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 -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
