aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/ViewPort/Role
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-12-17 16:32:16 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2007-12-17 16:32:16 +0000
commitddccc6a29affc90888a59f14d698fd3afb2757dc (patch)
treef6dec89af81aeb84fb308c961d92d049a7147e93 /lib/Reaction/UI/ViewPort/Role
parent27959b780ce142e88419e66dc8e6e7d571a41bb3 (diff)
downloadreaction-ddccc6a29affc90888a59f14d698fd3afb2757dc.tar.gz
reaction-ddccc6a29affc90888a59f14d698fd3afb2757dc.zip
new renamed viewports
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Role')
-rw-r--r--lib/Reaction/UI/ViewPort/Role/Actions.pm35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm
new file mode 100644
index 0000000..d7641be
--- /dev/null
+++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm
@@ -0,0 +1,35 @@
+package Reaction::UI::ViewPort::Role::Actions;
+
+use Reaction::Role;
+use Reaction::UI::ViewPort::Action::Link;
+
+role Actions, which {
+
+ has actions => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
+ has action_prototypes => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
+ implements _build_action_prototypes => as { [] };
+
+ implements _build_actions => as {
+ my ($self) = @_;
+ my (@act, $i);
+ my $ctx = $self->ctx;
+ #if i could abstract this vs ->object for row we could eliminate the entity
+ #version of this role and just use one for both things. that would be cool.
+ my $obj = $self->current_collection;
+ my $loc = $self->location;
+ foreach my $proto (@{ $self->action_prototypes }) {
+ my $action = Reaction::UI::ViewPort::Action::Link->new
+ (
+ ctx => $ctx,
+ target => $obj,
+ location => join ('-', $loc, 'action', $i++),
+ %$proto,
+ );
+ push(@act, $action);
+ }
+ return \@act;
+ };
+
+};
+
+1;