some boiler plate docs
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Role / Actions.pm
1 package Reaction::UI::ViewPort::Role::Actions;
2
3 use Reaction::Role;
4 use Reaction::UI::ViewPort::Action::Link;
5
6 role Actions, which {
7
8   has actions => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
9   has action_prototypes => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
10   implements _build_action_prototypes => as { [] };
11
12   implements _build_actions => as {
13     my ($self) = @_;
14     my (@act, $i);
15     my $ctx = $self->ctx;
16     my $loc = $self->location;
17     foreach my $proto (@{ $self->action_prototypes }) {
18       my $action = Reaction::UI::ViewPort::Action::Link->new
19         (
20          ctx      => $ctx,
21          target   => $self->model,
22          location => join ('-', $loc, 'action', $i++),
23          %$proto,
24         );
25       push(@act, $action);
26     }
27     return \@act;
28   };
29
30 };
31
32 1;
33
34 __END__;
35
36 =head1 NAME
37
38 Reaction::UI::ViewPort::Role::Actions
39
40 =head1 DESCRIPTION
41
42 A role to ease attaching actions to L<Reaction::InterfaceModel::Object>s
43
44 =head1 ATTRIBUTES
45
46 =head2 actions
47
48 =head2 action_prototypes
49
50 =head1 AUTHORS
51
52 See L<Reaction::Class> for authors.
53
54 =head1 LICENSE
55
56 See L<Reaction::Class> for the license.
57
58 =cut