Commit | Line | Data |
ddccc6a2 |
1 | package Reaction::UI::ViewPort::InterfaceModel::Field::File; |
2 | |
3 | use Reaction::Class; |
4 | use Reaction::Types::File; |
5 | |
6 | class File is 'Reaction::UI::ViewPort::InterfaceModel::Field', which { |
7 | |
8 | has '+value' => (isa => 'File', required => 0); |
9 | |
10 | override apply_our_events => sub { |
11 | my ($self, $ctx, $events) = @_; |
12 | my $value_key = join(':', $self->location, 'value'); |
13 | if (my $upload = $ctx->req->upload($value_key)) { |
14 | local $events->{$value_key} = $upload; |
15 | return super(); |
16 | } else { |
17 | return super(); |
18 | } |
19 | }; |
20 | |
21 | }; |
22 | |
23 | 1; |
24 | |
25 | =head1 NAME |
26 | |
27 | Reaction::UI::ViewPort::Field::File |
28 | |
29 | =head1 DESCRIPTION |
30 | |
31 | =head1 SEE ALSO |
32 | |
33 | =head2 L<Reaction::UI::ViewPort::Field> |
34 | |
35 | =head1 AUTHORS |
36 | |
37 | See L<Reaction::Class> for authors. |
38 | |
39 | =head1 LICENSE |
40 | |
41 | See L<Reaction::Class> for the license. |
42 | |
43 | =cut |