1 package Reaction::UI::ViewPort::Field::Mutable::File;
3 use Reaction::Types::File qw/Upload/;
6 use namespace::clean -except => [ qw(meta) ];
7 extends 'Reaction::UI::ViewPort::Field';
9 with 'Reaction::UI::ViewPort::Field::Role::Mutable::Simple';
11 has '+value' => (isa => Upload);
13 override apply_our_events => sub {
14 my ($self, $ctx, $events) = @_;
15 my $value_key = $self->event_id_for('value_string');
16 if (my $upload = $ctx->req->upload($value_key)) {
17 local $events->{$value_key} = $upload;
23 sub adopt_value_string {
25 $self->value($self->value_string) if $self->value_string;
27 override _value_string_from_value => sub { '' };
29 __PACKAGE__->meta->make_immutable;