1 package Reaction::UI::Widget::Field;
3 use Reaction::UI::WidgetClass;
5 use namespace::clean -except => [ qw(meta) ];
8 before fragment widget {
9 if ($_{viewport}->can('value_string')) {
10 arg 'field_value' => $_{viewport}->value_string;
12 arg 'field_value' => ''; #$_{viewport}->value;
16 implements fragment label_fragment {
17 if (my $label = $_{viewport}->label) {
18 arg label => localized $label;
23 __PACKAGE__->meta->make_immutable;
31 Reaction::UI::Widget::Field - A simple labelled text field
35 This widget renders a simple labelled text field.
41 Sets the C<field_value> argument either to the result of the C<value_string>
42 method on the viewport, or to an empty string if the viewport does not support
47 Will set the C<label> argument to the localised value of the viewport's C<label>
48 method and render the C<label> fragment I<if> the viewport's C<label> value
55 share/skin/base/layout/field.tt
57 The following layouts are provided:
63 Renders the C<label_fragment> and C<value_layout> fragments.
67 Renders a C<span> element with a C<field_label> class attribute containing the
68 C<label> argument and a double colon.
72 Renders a C<span> element with a C<field_value> class attribute containing the
73 C<field_value> argument.
79 share/skin/default/layout/field.tt
81 This layout set inherits from the C<NEXT> one in the skin inheritance.
83 The following layouts are provided:
87 The same as in the C<base> skin except that the C<label> argument is surrounded
88 by a C<strong> element.
92 For mutable fields see L<Reaction::UI::Widget::Field::Mutable>.
96 =item L<Reaction::UI::Field::Text>
98 A simple text subclass of L<Reaction::UI::Field>.
100 =item L<Reaction::UI::Field::String>
102 A simple string subclass of L<Reaction::UI::Field>.
104 =item L<Reaction::UI::Field::RelatedObject>
106 A simple subclass of L<Reaction::UI::Field>.
108 =item L<Reaction::UI::Field::Number>
110 A simple number subclass of L<Reaction::UI::Field>.
112 =item L<Reaction::UI::Field::Integer>
114 A simple integer subclass of L<Reaction::UI::Field>.
116 =item L<Reaction::UI::Field::Image>
118 A field representing an optional image.
120 =item L<Reaction::UI::Field::DateTime>
122 A simple DateTime subclass of L<Reaction::UI::Field>.
124 =item L<Reaction::UI::Field::Container>
126 A container field for multiple values.
128 =item L<Reaction::UI::Field::Collection>
130 A field containing a collection of localised values.
132 =item L<Reaction::UI::Field::Boolean>
134 A simple boolean subclass of L<Reaction::UI::Field>.
136 =item L<Reaction::UI::Field::Array>
138 A field representing an array of values, like L<Reaction::UI::Field::Collection>.
144 See L<Reaction::Class> for authors.
148 See L<Reaction::Class> for the license.