aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/ViewPort
diff options
context:
space:
mode:
authoredenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-02-11 23:39:31 +0000
committeredenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2009-02-11 23:39:31 +0000
commitc49a7624534cfd1a998fd8f7607856845a2b1bc4 (patch)
tree109c245ec544e3695dd0b288799a73de7035c861 /lib/Reaction/UI/ViewPort
parentf5e2ab69e2045b9ffe04b7436c7e2cf51bc4c4e9 (diff)
parentcf6fb234d0c47cf05376d6724a401ff8400e3ba5 (diff)
downloadreaction-c49a7624534cfd1a998fd8f7607856845a2b1bc4.tar.gz
reaction-c49a7624534cfd1a998fd8f7607856845a2b1bc4.zip
r9424@hades (orig r1029): groditi | 2009-01-27 20:52:49 -0300
remove unnecessary use of Reaction::Meta::Class r9533@hades (orig r1033): abs | 2009-02-05 18:49:51 -0300 Fix defualt -> default typos in perldoc r10126@hades (orig r1034): groditi | 2009-02-09 13:23:51 -0300 compat for new dbic r10130@hades (orig r1038): matthewt | 2009-02-10 17:58:57 -0300 add clearers for order and pager listview roles
Diffstat (limited to 'lib/Reaction/UI/ViewPort')
-rw-r--r--lib/Reaction/UI/ViewPort/Collection/Role/Order.pm8
-rw-r--r--lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm8
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/Reaction/UI/ViewPort/Collection/Role/Order.pm b/lib/Reaction/UI/ViewPort/Collection/Role/Order.pm
index 0121605..bb19f05 100644
--- a/lib/Reaction/UI/ViewPort/Collection/Role/Order.pm
+++ b/lib/Reaction/UI/ViewPort/Collection/Role/Order.pm
@@ -5,13 +5,19 @@ use Reaction::Role;
use namespace::clean -except => [ qw(meta) ];
-has order_by => (isa => 'Str', is => 'rw', trigger_adopt('order_by'));
+has order_by => (isa => 'Str', is => 'rw', trigger_adopt('order_by'), clearer => 'clear_order_by');
has order_by_desc => (isa => 'Int', is => 'rw', trigger_adopt('order_by'), lazy_build => 1);
sub _build_order_by_desc { 0 };
sub adopt_order_by {
shift->clear_current_collection;
};
+after clear_order_by => sub {
+ my ($self) = @_;
+ $self->order_by_desc(0);
+ $self->clear_current_collection;
+};
+
around _build_current_collection => sub {
my $orig = shift;
my ($self) = @_;
diff --git a/lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm b/lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm
index 64752a6..5f7c8f2 100644
--- a/lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm
+++ b/lib/Reaction/UI/ViewPort/Collection/Role/Pager.pm
@@ -11,7 +11,7 @@ use namespace::clean -except => [ qw(meta) ];
#has paged_collection => (isa => Collection, is => 'rw', lazy_build => 1);
has pager => (isa => 'Data::Page', is => 'rw', lazy_build => 1);
-has page => (isa => 'Int', is => 'rw', lazy_build => 1, trigger_adopt('page'));
+has page => (isa => 'Int', is => 'rw', lazy_build => 1, trigger_adopt('page'), clearer => 'clear_page');
has per_page => (isa => 'Int', is => 'rw', lazy_build => 1, trigger_adopt('page'));
has per_page_max => (isa => 'Int', is => 'rw', lazy_build => 1);
sub _build_page { 1 };
@@ -26,6 +26,12 @@ sub adopt_page {
$self->clear_current_collection;
};
+after clear_page => sub {
+ my ($self) = @_;
+ $self->clear_pager;
+ $self->clear_current_collection;
+};
+
around accept_events => sub { ('page','per_page', shift->(@_)); };
#implements build_paged_collection => as {