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

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 45 CC 3 SCAR 17.5
CC
3
Cov
0%
render_widget
12.0
accessors
2.0
handler_allowed
2.0
CRAP 5.8
1 use warnings;
2 use strict;
3
4 package Jifty::Web::Form::Field::Textarea;
5  
6 use base qw/Jifty::Web::Form::Field/;
7  
8 __PACKAGE__->mk_accessors(qw(rows cols));
9  
10 =head1 NAME
11  
12 Jifty::Web::Form::Field::Textarea - Add a multiline text field to your forms
13  
14 =head1 METHODS
15  
16 =head2 accessors
17  
18 Provide C<rows> and C<cols> accessors, in addition to
19 L<Jifty::Web::Form::Field>'s default accessors.
20  
21 =cut
22  
23 sub accessors { shift->SUPER::accessors(), 'rows', 'cols' }
24  
25 =head2 render_widget
26  
27 Renders the textarea widget.
28  
29 =cut
30  
31 sub render_widget {
32 my $self = shift;
33 my $field;
34 $field .= qq!<textarea!;
35 $field .= qq! name="@{[ $self->input_name ]}"!;
36 $field .= qq! id="@{[ $self->element_id ]}"!;
37 $field .= qq! title="@{[ $self->title ]}"! if ($self->title);
38 $field .= qq! rows="@{[$self->rows || 5 ]}"!;
39 $field .= qq! cols="@{[$self->cols || 60]}"!;
40 $field .= $self->_widget_class;
41 $field .= $self->javascript;
42 $field .= qq! >!;
43 $field .= Jifty->web->escape($self->current_value) if $self->current_value;
44 $field .= qq!</textarea>\n!;
45 Jifty->web->out($field);
46 '';
47 }
48  
49 =head2 handler_allowed HANDLER_NAME
50  
51 Returns 1 if the handler (e.g. onclick) is allowed. Undef otherwise.
52  
53 =cut
54  
55 sub handler_allowed {
56 my $self = shift;
57 my ($handler) = @_;
58  
59 return $self->SUPER::handler_allowed($handler) ||
60 {onselect => 1}->{$handler};
61  
62 }
63  
64  
65 1;