unlazified field value setting
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Field.pm
1 package Reaction::UI::Widget::Field;
2
3 use Reaction::UI::WidgetClass;
4
5 class Field, which {
6
7   before fragment widget {
8     if ($_{viewport}->can('value_string')) {
9       arg 'field_value' => $_{viewport}->value_string;
10     } else {
11       arg 'field_value' => ''; #$_{viewport}->value;
12     }
13   };
14
15   implements fragment label_fragment {
16     if (my $label = $_{viewport}->label) {
17       arg label => $label;
18       render 'label';
19     }
20   };
21
22 };
23
24 1;
25
26 __END__;
27
28 =head1 NAME
29
30 Reaction::UI::Widget::Field
31
32 =head1 DESCRIPTION
33
34 =head1 FRAGMENTS
35
36 =head2 widget
37
38 Additional variables available in topic hash: "viewport", "id", "name".
39
40 Renders "label","field" and "message"
41
42 =head2 field
43
44  C<content> will contain the value, if any,  of the field.
45
46 =head2 label
47
48  C<content> will contain the label, if any, of the field.
49
50 =head2 message
51
52  C<content> will contain the message, if any, of the field.
53
54 =head1 AUTHORS
55
56 See L<Reaction::Class> for authors.
57
58 =head1 LICENSE
59
60 See L<Reaction::Class> for the license.
61
62 =cut