LibreCat / Catmandu

Catmandu - a data processing toolkit
https://librecat.org
177 stars 31 forks source link

remove dependency on Data::SpreadPagination #19

Closed nics closed 10 years ago

vpeil commented 11 years ago

Nicolas, I have some simple formulas for calculating pagination. But I don't know how to implement it.

This is the current sub. sub _buildpager { my $self = $[0]; Data::SpreadPagination->new({ totalEntries => $self->total, entriesPerPage => $self->limit, startEntry => $self->start+1, maxPages => $self->max_pages_in_spread, }); }

How should the new sub look like? What kind of object(?)/stuff should it return.

nics commented 11 years ago

Hi vitali,

it think it would be best to implement the pager as a Moo::Role

something like

package Catmandu::Paged;

requires 'total'; requires 'limit'; requires 'start';

sub current_page { …. }

sub next_page { …. }

http://cpansearch.perl.org/src/LBROCARD/Data-Page-2.02/lib/Data/Page.pm

has everything we need to steal ;-)

On 03 Sep 2013, at 08:55, Vitali Peil wrote:

Nicolas, I have some simple formulas for calculating pagination. But I don't know how to implement it.

This is the current sub. sub build_pager { my $self = $[0]; Data::SpreadPagination->new({ totalEntries => $self->total, entriesPerPage => $self->limit, startEntry => $self->start+1, maxPages => $self->max_pages_in_spread, }); }

How should the new sub look like? What kind of object(?)/stuff should it return.

— Reply to this email directly or view it on GitHub.

nics commented 10 years ago

duplicates #32

vpeil commented 10 years ago

Well, #32 is the pull request for this issue. So every pull request concerning an issue will be a duplicate.