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