Commit | Line | Data |
8f19d042 |
1 | package Reaction::UI::Widget::Field; |
2 | |
3 | use Reaction::UI::WidgetClass; |
4 | |
5 | class Field, which { |
6 | |
7 | has id => (isa => 'Str', is => 'ro', lazy_build => 1); |
8 | has name => (isa => 'Str', is => 'ro', lazy_build => 1); |
9 | |
10 | implements build_id => as { shift->viewport->event_id_for('value'); }; |
11 | implements build_name => as { shift->viewport->event_id_for('value'); }; |
12 | |
13 | widget renders [qw/label field message/ |
14 | => { id => func('self', 'id'), |
15 | name => func('self', 'name'), |
16 | viewport => func('self', 'viewport'), } |
17 | ]; |
18 | |
a5200252 |
19 | field renders [ string { $_{viewport}->value }, ]; |
20 | |
8f19d042 |
21 | label renders [ string { $_{viewport}->label }, ]; |
22 | message renders [ string { $_{viewport}->message }, ]; |
23 | |
8f19d042 |
24 | }; |
25 | |
26 | 1; |
27 | |
6ab43711 |
28 | __END__; |
29 | |
5a1a893e |
30 | =head1 NAME |
31 | |
32 | Reaction::UI::Widget::Field |
33 | |
34 | =head1 DESCRIPTION |
35 | |
36 | =head1 ATTRIBUTES |
37 | |
38 | =head2 id |
39 | |
40 | Str, lazy builds. |
41 | |
42 | =head2 name |
43 | |
44 | Str, lazy builds. |
45 | |
46 | =head1 METHODS |
47 | |
48 | =head2 build_id |
49 | |
50 | Returns the viewport's C<event_id_for('value')> |
51 | |
52 | =head2 build_name |
53 | |
54 | Returns the viewport's C<event_id_for('value')> |
55 | |
56 | =head1 FRAGMENTS |
57 | |
58 | =head2 widget |
59 | |
60 | Additional variables available in topic hash: "viewport", "id", "name". |
61 | |
62 | Renders "label","field" and "message" |
63 | |
64 | =head2 field |
65 | |
66 | C<content> will contain the value, if any, of the field. |
67 | |
68 | =head2 label |
69 | |
70 | C<content> will contain the label, if any, of the field. |
71 | |
72 | =head2 message |
73 | |
74 | C<content> will contain the message, if any, of the field. |
75 | |
76 | =head1 AUTHORS |
77 | |
78 | See L<Reaction::Class> for authors. |
79 | |
80 | =head1 LICENSE |
81 | |
82 | See L<Reaction::Class> for the license. |
83 | |
84 | =cut |