renaming widget packages to match new viewports
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Role / Actions.pm
CommitLineData
ddccc6a2 1package Reaction::UI::ViewPort::Role::Actions;
b8faba69 2
3use Reaction::Role;
ddccc6a2 4use Reaction::UI::ViewPort::Action::Link;
b8faba69 5
6role Actions, which {
7
8 has actions => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
9 has action_prototypes => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
89939ff9 10 implements _build_action_prototypes => as { [] };
b8faba69 11
89939ff9 12 implements _build_actions => as {
b8faba69 13 my ($self) = @_;
14 my (@act, $i);
15 my $ctx = $self->ctx;
16 #if i could abstract this vs ->object for row we could eliminate the entity
17 #version of this role and just use one for both things. that would be cool.
18 my $obj = $self->current_collection;
19 my $loc = $self->location;
20 foreach my $proto (@{ $self->action_prototypes }) {
ddccc6a2 21 my $action = Reaction::UI::ViewPort::Action::Link->new
b8faba69 22 (
23 ctx => $ctx,
24 target => $obj,
25 location => join ('-', $loc, 'action', $i++),
26 %$proto,
27 );
28 push(@act, $action);
29 }
30 return \@act;
31 };
32
33};
34
351;