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