lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm

filter: Statementstmt 57.1% 20 / 35 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 4 / 12 Podpod 0.0% 0 / 1 totaltotal 50.0% 24 / 48 CC 1 SCAR 4.7
CC
1
Cov
57%
_build_page
2.0
_build_per_page
2.0
_build_per_page_max
2.0
CRAP 1.6
« lib/Reaction/UI/Widget/Collection.pm ↑ Summary lib/Reaction/UI/Widget/Field/Array.pm »
1 package Reaction::UI::ViewPort::Collection::Role::Pager;
2  
3 5 ▶use Reaction::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶use aliased 'Reaction::InterfaceModel::Collection';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # XX This needs to be consumed after Ordered
8 5 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use MooseX::Types::Moose qw/Int/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 #has paged_collection => (isa => Collection, is => 'rw', lazy_build => 1);
12  
13 5 has pager => (isa => 'Data::Page', is => 'rw', lazy_build => 1);
14 5 has page => (isa => Int, is => 'rw', lazy_build => 1, trigger_adopt('page'), clearer => 'clear_page');
15 5 has per_page => (isa => Int, is => 'rw', lazy_build => 1, trigger_adopt('page'));
16 5 has per_page_max => (isa => Int, is => 'rw', lazy_build => 1);
17 0 ▶sub _build_page { 1 };
Subroutine _build_page: not called CC=1 SCAR=6.9
18 0 ▶sub _build_per_page { 10 };
Subroutine _build_per_page: not called CC=1 SCAR=6.9
19 0 ▶sub _build_per_page_max { 100 };
Subroutine _build_per_page_max: not called CC=1 SCAR=6.9
20 0 ▶sub _build_pager { shift->current_collection->pager };
Subroutine _build_pager: not called CC=1 SCAR=6.9
21 0 ▶sub adopt_page {
Subroutine adopt_page: not called CC=1 SCAR=6.9
Pod undocumented
22 0 my ($self) = @_;
23 #$self->clear_paged_collection;
24  
25 0 $self->clear_pager;
26 0 $self->clear_current_collection;
27 };
28  
29 0 ▶after clear_page => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 my ($self) = @_;
31 0 $self->clear_pager;
32 0 $self->clear_current_collection;
33 5 };
34  
35 0 ▶around accept_events => sub { ('page','per_page', shift->(@_)); };
Subroutine __ANON__: not called CC=1 SCAR=1.2
36  
37 #implements build_paged_collection => as {
38 # my ($self) = @_;
39 # my $collection = $self->current_collection;
40 # return $collection->where(undef, {rows => $self->per_page})->page($self->page);
41 #};
42  
43 0 ▶around _build_current_collection => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
44 0 my $orig = shift;
45 0 my ($self) = @_;
46 0 my $collection = $orig->(@_);
47 0 return $collection->where(undef, {rows => $self->per_page})->page($self->page);
48 5 };
49  
50 5 1;
51  
52 __END__;
« lib/Reaction/UI/Widget/Collection.pm ↑ Summary lib/Reaction/UI/Widget/Field/Array.pm »