port actionform, field widgets to declarative system
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field / File.pm
CommitLineData
7adfd53f 1package Reaction::UI::ViewPort::Field::File;
2
3use Reaction::Class;
4use Reaction::Types::File;
5
6class File is 'Reaction::UI::ViewPort::Field', which {
7
8 has '+value' => (isa => 'File', required => 0);
6ab43711 9
10 #has '+layout' => (default => 'file');
11
7adfd53f 12 override apply_our_events => sub {
13 my ($self, $ctx, $events) = @_;
14 my $value_key = join(':', $self->location, 'value');
15 if (my $upload = $ctx->req->upload($value_key)) {
16 local $events->{$value_key} = $upload;
17 return super();
18 } else {
19 return super();
20 }
21 };
22
23};
24
251;
26
27=head1 NAME
28
29Reaction::UI::ViewPort::Field::File
30
31=head1 DESCRIPTION
32
33=head1 SEE ALSO
34
35=head2 L<Reaction::UI::ViewPort::Field>
36
37=head1 AUTHORS
38
39See L<Reaction::Class> for authors.
40
41=head1 LICENSE
42
43See L<Reaction::Class> for the license.
44
45=cut