From 07a9ef7dbcbcd2b0202b4d529602e95039a62944 Mon Sep 17 00:00:00 2001 From: wreis Date: Sat, 1 Aug 2009 02:16:25 +0000 Subject: updated FieldArgs role after merge --- lib/Reaction/UI/ViewPort/Role/Actions.pm | 13 +++++-------- lib/Reaction/UI/ViewPort/Role/FieldArgs.pm | 9 --------- 2 files changed, 5 insertions(+), 17 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; diff --git a/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm b/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm index bff31c2..0a2aa51 100644 --- a/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm +++ b/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm @@ -64,17 +64,8 @@ around _build_members => sub { 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; }; -- cgit v1.2.3-54-g00ecf