Jifty/Web/Form/Field/Uploads.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 32 CC 1 SCAR 6.9
CC
1
Cov
0%
render_widget
2.0
render_value
2.0
classes
2.0
CRAP 2.0
1 use warnings;
2 use strict;
3
4 package Jifty::Web::Form::Field::Uploads;
5  
6 =head1 NAME
7  
8 Jifty::Web::Form::Field::Uploads - File uploads field
9  
10 =head1 DESCRIPTION
11  
12 An input field that renders using C<< <input type="file" /> >>. The
13 argument value that the action receives from this field via
14 L<Jifty::Action/argument_value> will be a filehandle, which can be
15 read in the usual ways.
16  
17 =cut
18  
19 use base qw/Jifty::Web::Form::Field/;
20  
21 =head2 render_widget
22  
23 Renders the file upload widget.
24  
25 =cut
26  
27 sub render_widget {
28 my $self = shift;
29 my $field = qq!<div class="uploads">!;
30 $field .= qq!<input type="file" name="@{[ $self->input_name ]}" !;
31 $field .= $self->_widget_class();
32 $field .= $self->javascript;
33 $field .= qq!/>!;
34 $field .= qq!<a href="#" class="attach-more">!;
35 $field .= _('Attach another file');
36 $field .= qq!</a></div>!;
37 Jifty->web->out($field);
38 '';
39 }
40  
41  
42 =head2 render_value
43  
44 The 'value', rendered, is empty so that BLOBs and the like don't get
45 streamed to the browser.
46  
47 =cut
48  
49 sub render_value {
50 '';
51 }
52  
53 =head2 classes
54  
55 Add 'upload' to the rest of the classes
56  
57 =cut
58  
59 sub classes {
60 my $self = shift;
61 return join(' ', 'upload', ($self->SUPER::classes));
62 }
63  
64 1;