-- cgit v1.2.3-54-g00ecf From 565a1fc7fe67c721f2766bdc3f55c5fcb33fc760 Mon Sep 17 00:00:00 2001 From: wreis Date: Thu, 30 Jul 2009 21:13:22 +0000 Subject: added action_filter --- lib/Reaction/UI/ViewPort/Role/Actions.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm index 6f3cd6a..e78ba4d 100644 --- a/lib/Reaction/UI/ViewPort/Role/Actions.pm +++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm @@ -16,6 +16,14 @@ has action_order => ( isa => 'ArrayRef' ); +has action_filter => ( + isa => 'CodeRef', is => 'ro', + required => '1', lazy => '1', + default => sub { + sub { return [keys %{ shift->action_prototypes }] } + } +); + has action_prototypes => ( is => 'ro', isa => 'HashRef', @@ -35,7 +43,7 @@ sub _build_computed_action_order { ($self->has_action_order ? $self->action_order : []), [ keys %{ $self->action_prototypes } ] ); - return $ordered ; + return $self->action_filter->($ordered, $self->model); } sub _build_actions { -- cgit v1.2.3-54-g00ecf From f59e3c5e53dbbb3b6aa0fcedbd56f2f3f768e8c9 Mon Sep 17 00:00:00 2001 From: wreis Date: Thu, 30 Jul 2009 21:39:15 +0000 Subject: fixed default value --- lib/Reaction/UI/ViewPort/Role/Actions.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm index e78ba4d..368330b 100644 --- a/lib/Reaction/UI/ViewPort/Role/Actions.pm +++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm @@ -20,7 +20,8 @@ has action_filter => ( isa => 'CodeRef', is => 'ro', required => '1', lazy => '1', default => sub { - sub { return [keys %{ shift->action_prototypes }] } + my $self = shift; + sub { return [keys %{ $self->action_prototypes }] } } ); -- cgit v1.2.3-54-g00ecf