aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/ViewPort/Role/Actions.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Role/Actions.pm')
-rw-r--r--lib/Reaction/UI/ViewPort/Role/Actions.pm13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm
index 32c7bbb..eb8ad76 100644
--- a/lib/Reaction/UI/ViewPort/Role/Actions.pm
+++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm
@@ -5,12 +5,6 @@ use Reaction::UI::ViewPort::URI;
use namespace::clean -except => [ qw(meta) ];
-has actions => (
- is => 'ro',
- isa => 'ArrayRef',
- lazy_build => 1
-);
-
has action_order => (
is => 'ro',
isa => 'ArrayRef'
@@ -50,14 +44,17 @@ sub _build_computed_action_order {
return $ordered;
}
-sub _build_actions {
+sub actions {
my ($self) = @_;
my (@act, $i);
my $ctx = $self->ctx;
my $loc = $self->location;
my $target = $self->model;
+ my $valid_actions = $self->has_action_filter ?
+ $self->action_filter->($self->computed_action_order, $self->model)
+ : $self->computed_action_order;
- foreach my $proto_name ( @{ $self->computed_action_order } ) {
+ foreach my $proto_name ( @$valid_actions ) {
my $proto = $self->action_prototypes->{$proto_name};
my $uri = $proto->{uri} or confess('uri is required in prototype action');
my $label = exists $proto->{label} ? $proto->{label} : $proto_name;