work in progress, listview still broken
[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;
b8faba69 16 my $loc = $self->location;
17 foreach my $proto (@{ $self->action_prototypes }) {
ddccc6a2 18 my $action = Reaction::UI::ViewPort::Action::Link->new
b8faba69 19 (
20 ctx => $ctx,
c8fbb8ad 21 target => $self->model,
b8faba69 22 location => join ('-', $loc, 'action', $i++),
23 %$proto,
24 );
25 push(@act, $action);
26 }
27 return \@act;
28 };
29
30};
31
321;