From: wreis Date: Thu, 30 Jul 2009 21:13:22 +0000 (+0000) Subject: added action_filter X-Git-Tag: v0.002000~53^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=565a1fc7fe67c721f2766bdc3f55c5fcb33fc760;p=catagits%2FReaction.git added action_filter --- 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 {