one rendering context per request
[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
89939ff9 10 implements _build_id => as { shift->viewport->event_id_for('value'); };
11 implements _build_name => as { shift->viewport->event_id_for('value'); };
8f19d042 12
6bc27bd3 13 fragment widget [qw/label field message/
8f19d042 14 => { id => func('self', 'id'),
b8faba69 15 name => func('self', 'name'), }
8f19d042 16 ];
17
6bc27bd3 18 fragment field [ string { $_{viewport}->value }, ];
a5200252 19
6bc27bd3 20 fragment label [ string { $_{viewport}->label }, ];
21 fragment message [ string { $_{viewport}->message }, ];
8f19d042 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
89939ff9 47=head2 _build_id
5a1a893e 48
49Returns the viewport's C<event_id_for('value')>
50
89939ff9 51=head2 _build_name
5a1a893e 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