use namespace::clean -except => [ qw(meta) ];
-has actions => (
- is => 'ro',
- isa => 'ArrayRef',
- lazy_build => 1
-);
-
has action_order => (
is => 'ro',
isa => 'ArrayRef'
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;
my $orig = shift;
my $self = shift;
$self->member_args->{computed_field_order} ||= $self->computed_field_order;
- $self->member_args->{computed_action_order} ||= [];
my $members = $self->$orig(@_);
- # cache everything yo
- for my $member (@$members){
- $member->clear_computed_action_order;
- my $order = $member->computed_action_order;
- @{ $self->member_args->{computed_action_order} } = @$order;
- last;
- }
-
return $members;
};