renaming widget packages to match new viewports
[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 ATTRIBUTES
35
36 =head2 id
37
38 Str, lazy builds.
39
40 =head2 name
41
42 Str, lazy builds.
43
44 =head1 METHODS
45
46 =head2 _build_id
47
48 Returns the viewport's C<event_id_for('value')>
49
50 =head2 _build_name
51
52 Returns the viewport's C<event_id_for('value')>
53
54 =head1 FRAGMENTS
55
56 =head2 widget
57
58 Additional variables available in topic hash: "viewport", "id", "name".
59
60 Renders "label","field" and "message"
61
62 =head2 field
63
64  C<content> will contain the value, if any,  of the field.
65
66 =head2 label
67
68  C<content> will contain the label, if any, of the field.
69
70 =head2 message
71
72  C<content> will contain the message, if any, of the field.
73
74 =head1 AUTHORS
75
76 See L<Reaction::Class> for authors.
77
78 =head1 LICENSE
79
80 See L<Reaction::Class> for the license.
81
82 =cut