Commit | Line | Data |
7adfd53f |
1 | package Reaction::UI::ViewPort::Field::File; |
2 | |
3 | use Reaction::Class; |
7adfd53f |
4 | |
5 | class File is 'Reaction::UI::ViewPort::Field', which { |
6 | |
4ed8c1eb |
7 | has uri => ( is => 'rw', lazy_build => 1); |
6ab43711 |
8 | |
4ed8c1eb |
9 | has action => (isa => 'CodeRef', is => 'rw', required => 1); |
6ab43711 |
10 | |
4ed8c1eb |
11 | implements _build_uri => as{ |
12 | my $self = shift; |
13 | my $c = $self->ctx; |
14 | my ($c_name, $a_name, @rest) = @{ $self->action->($self->model, $c) }; |
15 | $c->uri_for($c->controller($c_name)->action_for($a_name),@rest); |
7adfd53f |
16 | }; |
17 | |
4ed8c1eb |
18 | implements _value_string_from_value => as { |
19 | shift->value->stringify; |
20 | }; |
21 | |
7adfd53f |
22 | }; |
23 | |
24 | 1; |