diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2007-12-17 16:32:16 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2007-12-17 16:32:16 +0000 |
commit | ddccc6a29affc90888a59f14d698fd3afb2757dc (patch) | |
tree | f6dec89af81aeb84fb308c961d92d049a7147e93 /lib/Reaction/UI/ViewPort/Action | |
parent | 27959b780ce142e88419e66dc8e6e7d571a41bb3 (diff) | |
download | reaction-ddccc6a29affc90888a59f14d698fd3afb2757dc.tar.gz reaction-ddccc6a29affc90888a59f14d698fd3afb2757dc.zip |
new renamed viewports
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Action')
-rw-r--r-- | lib/Reaction/UI/ViewPort/Action/Link.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Reaction/UI/ViewPort/Action/Link.pm b/lib/Reaction/UI/ViewPort/Action/Link.pm new file mode 100644 index 0000000..314c6a3 --- /dev/null +++ b/lib/Reaction/UI/ViewPort/Action/Link.pm @@ -0,0 +1,27 @@ +package Reaction::UI::ViewPort::InterfaceModel::Action::Link; + +use Reaction::Class; + +class Link is 'Reaction::UI::ViewPort', which { + + has label => (is => 'rw', required => 1); + has uri => ( is => 'rw', lazy_build => 1); + + has target => (isa => 'Object', is => 'rw', required => 1); + has action => (isa => 'CodeRef', is => 'rw', required => 1); + + implements BUILD => as{ + my $self = shift; + $self->label( $self->label->($self->target) ) if ref $self->label eq 'CODE'; + }; + + implements _build_uri => as{ + my $self = shift; + my $c = $self->ctx; + my ($c_name, $a_name, @rest) = @{ $self->action->($self->target, $c) }; + $c->uri_for($c->controller($c_name)->action_for($a_name),@rest); + }; + +}; + +1; |