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