| 1 | package HTML::FormHandler::Widget::Wrapper::Bootstrap3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Twitter Bootstrap 3.0 field wrapper | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | $HTML::FormHandler::Widget::Wrapper::Bootstrap3::VERSION = '0.410002'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use Moose::Role; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use namespace::autoclean; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use HTML::FormHandler::Render::Util ('process_attrs'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use List::Util 1.33 ('any'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use HTML::Entities qw( encode_entities ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | with 'HTML::FormHandler::Widget::Wrapper::Base'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | sub is_b3 {1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_b3: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 20 | ▶ | sub build_wrapper_tags { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_wrapper_tags: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 20 | radio_element_wrapper => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | checkbox_element_wrapper => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 23 | ▶ | sub wrap_field { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap_field: called CC=13 SCAR=26.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 23 | my ( $self, $result, $rendered_widget ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 23 | my $output; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # create attribute string for wrapper | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 23 | ▶ | if ( $self->do_wrapper ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 20 | my $attr = $self->wrapper_attributes($result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # no 'control-group' class for Hidden fields, 'form-actions' for submit/reset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 20 | my $div_class = 'form-group'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 20 | unshift @{$attr->{class}}, $div_class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 20 | my $attr_str = process_attrs( $attr ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # wrapper is always a div | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 20 | $output .= $self->get_tag('before_wrapper'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 20 | $output .= qq{\n<div$attr_str>}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # render the label | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 23 | ▶ | $output .= "\n" . $self->do_render_label($result, undef, ['control-label'] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | if $self->do_label; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 23 | $output .= $self->get_tag('before_element'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # the controls div; used to have 'controls' class. Now it comes from | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # the 'element_wrapper_class'. Used for column layout. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 23 | my $ew_attr = $self->element_wrapper_attributes($result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 23 | my $element_wrapper_attrs = process_attrs( $ew_attr ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 23 | ▶ | $output .= qq{\n<div$element_wrapper_attrs>} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | unless !$self->do_wrapper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # yet another tag | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 23 | $output .= $self->get_tag('before_element_inside_div'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # handle input-prepend and input-append | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 23 | ▶ | if( $self->get_tag('input_prepend') || $self->get_tag('input_append') || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
$self->get_tag("input_prepend") or $self->get_tag("input_append") or $self->get_tag("input_append_button")
$self->get_tag("input_prepend") or $self->get_tag("input_append")
MC/DC0%0/3
$self->get_tag("input_prepend") or $self->get_tag("input_append") or $self->get_tag("input_append_button")
$self->get_tag("input_prepend")
$self->get_tag("input_append")
$self->get_tag("input_append_button")
Truth table25%1/4
A or B or C
A= $self->get_tag("input_prepend")B= $self->get_tag("input_append")C= $self->get_tag("input_append_button")
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | $self->get_tag('input_append_button') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | $rendered_widget = $self->do_prepend_append($rendered_widget); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | elsif( lc $self->widget eq 'checkbox' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 7 | $rendered_widget = $self->wrap_checkbox($result, $rendered_widget, 'b3_label_left') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 23 | $output .= "\n$rendered_widget"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # various 'help-inline' bits: errors, warnings | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 23 | ▶ | unless( $self->get_tag('no_errors') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | $output .= qq{\n<span class="help-block">$_</span>} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 23 | for map { encode_entities($_) } $result->all_errors; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 23 | $output .= qq{\n<span class="help-block">$_</span>} for $result->all_warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # extra after element stuff | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 23 | $output .= $self->get_tag('after_element'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # close element_wrapper 'control' div | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 23 | ▶ | $output .= '</div>' unless !$self->do_wrapper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # close wrapper | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 23 | ▶ | if ( $self->do_wrapper ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 20 | $output .= "\n</div>"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 20 | $output .= $self->get_tag('after_wrapper'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 23 | return "$output"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # don't render label for checkboxes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 16 | ▶ | sub do_render_label { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_render_label: called CC=2 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 16 | my ( $self ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 16 | ▶ | return '' if $self->type_attr eq 'checkbox'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 13 | HTML::FormHandler::Widget::Wrapper::Base::do_render_label(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 17 | ▶ | sub add_standard_element_classes { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_standard_element_classes: called CC=8 SCAR=22.3
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 17 | my ( $self, $result, $class ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 17 | ▶ | push @$class, 'has-error' if $result->has_errors; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 17 | ▶ | push @$class, 'has-warning' if $result->has_warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 17 | ▶ | push @$class, 'disabled' if $self->disabled; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 17 | ▶ | push @$class, 'form-control' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
$self->html_element eq "select" or $self->html_element eq "textarea" or $self->type_attr eq "text" or $self->type_attr eq "password"
$self->html_element eq "select" or $self->html_element eq "textarea" or $self->type_attr eq "text"
$self->html_element eq "select" or $self->html_element eq "textarea"
MC/DC25%1/4
$self->html_element eq "select" or $self->html_element eq "textarea" or $self->type_attr eq "text" or $self->type_attr eq "password"
$self->html_element eq "select"
$self->html_element eq "textarea"
$self->type_attr eq "text"
$self->type_attr eq "password"
Truth table40%2/5
A or B or C or D
A= $self->html_element eq "select"B= $self->html_element eq "textarea"C= $self->type_attr eq "text"D= $self->type_attr eq "password"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | if $self->html_element eq 'select' || $self->html_element eq 'textarea' || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | $self->type_attr eq 'text' || $self->type_attr eq 'password'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 20 | ▶ | sub add_standard_wrapper_classes { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_standard_wrapper_classes: called CC=4 SCAR=14.2
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 20 | my ( $self, $result, $class ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 20 | ▶ | push @$class, 'has-error' if ( $result->has_error_results || $result->has_errors ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$result->has_error_results or $result->has_errors
MC/DC50%1/2
$result->has_error_results or $result->has_errors
$result->has_error_results
$result->has_errors
Truth table66%2/3
A or B
A= $result->has_error_resultsB= $result->has_errors
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 20 | ▶ | push @$class, 'has-warning' if $result->has_warnings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # TODO: has-success? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 13 | ▶ | sub add_standard_label_classes { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_standard_label_classes: called CC=4 SCAR=14.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 13 | my ( $self, $result, $class ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 13 | ▶ | if ( my $classes = $self->form->get_tag('layout_classes') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 9 | my $label_class = $classes->{label_class}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ( $label_class && not any { $_ =~ /^col\-/ } @$class ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.7
Branch: 1 branch
Condition33%1/3
$label_class and not &any(sub {
$_ =~ /^col\-/;
}
, @$class)
MC/DC0%0/2
$label_class and not &any(sub {
$_ =~ /^col\-/;
}
, @$class)
$label_class
not &any(sub {
$_ =~ /^col\-/;
}
, @$class)
Truth table33%1/3
A and not(B)
A= $label_classB= not &any(sub {
$_ =~ /^col\-/;
}
, @$class)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 9 | push @$class, @{$classes->{label_class}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 23 | ▶ | sub add_standard_element_wrapper_classes { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_standard_element_wrapper_classes: called CC=8 SCAR=20.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 23 | my ( $self, $result, $class ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 23 | ▶ | if ( my $classes = $self->form->get_tag('layout_classes') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 17 | ▶ | if ( exists $classes->{element_wrapper_class} && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $classes->{"element_wrapper_class"} and not &any(sub {
$_ =~ /^col\-/;
}
, @$class)
MC/DC50%1/2
exists $classes->{"element_wrapper_class"} and not &any(sub {
$_ =~ /^col\-/;
}
, @$class)
exists $classes->{"element_wrapper_class"}
not &any(sub {
$_ =~ /^col\-/;
}
, @$class)
Truth table66%2/3
A and not(B)
A= exists $classes->{"element_wrapper_class"}B= not &any(sub {
$_ =~ /^col\-/;
}
, @$class)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | ▶ | not any { $_ =~ /^col\-/ } @$class ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 15 | push @$class, @{$classes->{element_wrapper_class}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 17 | ▶ | if ( exists $classes->{no_label_element_wrapper_class} && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
exists $classes->{"no_label_element_wrapper_class"} and !$self->do_label || $self->type_attr eq "checkbox" and not &any(sub {
$_ =~ /^col\-.*offset/;
}
, @$class)
exists $classes->{"no_label_element_wrapper_class"} and !$self->do_label || $self->type_attr eq "checkbox"
not $self->do_label or $self->type_attr eq "checkbox"
MC/DC50%2/4
exists $classes->{"no_label_element_wrapper_class"} and !$self->do_label || $self->type_attr eq "checkbox" and not &any(sub {
$_ =~ /^col\-.*offset/;
}
, @$class)
exists $classes->{"no_label_element_wrapper_class"}
not $self->do_label
$self->type_attr eq "checkbox"
not &any(sub {
$_ =~ /^col\-.*offset/;
}
, @$class)
Truth table50%3/6
A and not(B) or C and not(D)
A= exists $classes->{"no_label_element_wrapper_class"}B= not $self->do_labelC= $self->type_attr eq "checkbox"D= not &any(sub {
$_ =~ /^col\-.*offset/;
}
, @$class)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ( ! $self->do_label || $self->type_attr eq 'checkbox' ) && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 8 | ▶ | not any { $_ =~ /^col\-.*offset/ } @$class ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 8 | push @$class, @{$classes->{no_label_element_wrapper_class}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 7 | ▶ | sub wrap_checkbox { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap_checkbox: called CC=5 SCAR=16.7
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 7 | my ( $self, $result, $rendered_widget ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # use the regular label | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 7 | ▶ | my $label = $self->option_label || $self->label; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->option_label || $self->label
MC/DC0%0/2
$self->option_label || $self->label
$self->option_label
$self->label
Truth table33%1/3
A || B
A= $self->option_labelB= $self->label
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 7 | ▶ | $label = $self->get_tag('label_no_filter') ? $self->_localize($label) : $self->html_filter($self->_localize($label)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 7 | my $id = $self->id; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 7 | my $for = qq{ for="$id"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # return unwrapped checkbox with 'checkbox-inline' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 7 | ▶ | return qq{<label class="checkbox-inline" $for>$rendered_widget\n$label\n</label>} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | if( $self->get_tag('inline') ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # return wrapped checkbox, either on left or right | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 4 | ▶ | return qq{<div class="checkbox"><label$for>\n$label\n$rendered_widget</label></div>} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | if( $self->get_tag('label_left') ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 4 | return qq{<div class="checkbox"><label$for>$rendered_widget\n$label\n</label></div>}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub do_prepend_append { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_prepend_append: not called CC=8 SCAR=42.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my ( $self, $rendered_widget ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my @class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if( my $ip_tag = $self->get_tag('input_prepend' ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $rendered_widget = qq{<span class="input-group-addon">$ip_tag</span>$rendered_widget}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | push @class, 'input-group'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | if ( my $ia_tag = $self->get_tag('input_append' ) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $rendered_widget = qq{$rendered_widget<span class="input-group-addon">$ia_tag</span>}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | push @class, 'input-group'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if ( my $iab_tag = $self->get_tag('input_append_button') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $iab_element_attr_tag = $self->get_tag('input_append_button_element_attr'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my ($btn_class, $attr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if (ref $iab_element_attr_tag eq 'HASH') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | $btn_class = ref $iab_element_attr_tag->{class} eq 'ARRAY' ? shift @{$iab_element_attr_tag->{class}} : $iab_element_attr_tag->{class}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $attr = process_attrs( $iab_element_attr_tag ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | my @buttons = ref $iab_tag eq 'ARRAY' ? @$iab_tag : ($iab_tag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my $group = qq{<span class="input-group-btn">}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | foreach my $btn ( @buttons ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | $group .= qq{<button type="button" class="btn $btn_class"$attr>$btn</button>}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $group .= qq{</span>}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $rendered_widget = qq{$rendered_widget$group}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | push @class, 'input-group'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my $attr = process_attrs( { class => \@class } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $rendered_widget = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | qq{<div$attr> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | $rendered_widget | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | </div>}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | return $rendered_widget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 6 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||