do not include .git directory
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Field / Mutable / Boolean.pm
CommitLineData
2f670e13 1package Reaction::UI::Widget::Field::Mutable::Boolean;
2
3use Reaction::UI::WidgetClass;
4
bae75bee 5use namespace::clean -except => [ qw(meta) ];
6extends 'Reaction::UI::Widget::Field::Mutable';
2f670e13 7
bae75bee 8
9
10after fragment widget {
11 arg 'field_type' => 'checkbox';
12};
13
14implements fragment is_checked {
15 if ($_{viewport}->value_string) {
16 render 'is_checked_yes';
17 } else {
18 render 'is_checked_no';
19 }
2f670e13 20};
21
bae75bee 22__PACKAGE__->meta->make_immutable;
23
24
2f670e13 251;
26
27__END__;
28
29=head1 NAME
30
e516f7e6 31Reaction::UI::Widget::Field::Mutable::Boolean - A mutable boolean field
2f670e13 32
33=head1 DESCRIPTION
34
f9b32c83 35Provides a widget to manipulate a boolean value. This is a subclass of
36L<Reaction::UI::Widget::Field::Mutable>.
37
38=head1 FRAGMENTS
39
40=head2 widget
41
42Will set the argument C<field_type> to C<checkbox>.
43
44=head2 is_checked
45
46Will render the C<is_checked_yes> fragment if the viewport has a true C<value_string>
47or C<is_checked_no> if it does not.
48
49=head1 LAYOUT SETS
50
51=head2 base
52
53 share/skin/base/layout/field/mutable/boolean.tt
54
55This layout set extends the next C<field/mutable> layout set in the skin inheritance.
56
57The following layouts are provided:
58
59=over 4
60
61=item widget
62
63Renders the input element that will be the checkbox.
64
65=item field_body
66
67Sets the value element attribute to 1 and renders the C<is_checked> fragment afterwards.
68
69=item is_checked_yes
70
71Sets the C<checked> attribute of the input element to C<checked>.
72
73=item is_checked_no
74
75Empty.
76
77=back
2f670e13 78
79=head1 AUTHORS
80
81See L<Reaction::Class> for authors.
82
83=head1 LICENSE
84
85See L<Reaction::Class> for the license.
86
87=cut