aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/Widget/Field.pm
blob: 1e5de08b1d7676931050d9dbf4c7bdfde7ae0872 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package Reaction::UI::Widget::Field;

use Reaction::UI::WidgetClass;

class Field, which {

  has id   => (isa => 'Str', is => 'ro', lazy_build => 1);
  has name => (isa => 'Str', is => 'ro', lazy_build => 1);

  implements _build_id   => as { shift->viewport->event_id_for('value'); };
  implements _build_name => as { shift->viewport->event_id_for('value'); };

  widget renders [qw/label field message/
                  => { id       => func('self', 'id'),
                       name     => func('self', 'name'), }
                 ];

  field   renders [ string { $_{viewport}->value },   ];

  label   renders [ string { $_{viewport}->label   }, ];
  message renders [ string { $_{viewport}->message }, ];

};

1;

__END__;

=head1 NAME

Reaction::UI::Widget::Field

=head1 DESCRIPTION

=head1 ATTRIBUTES

=head2 id

Str, lazy builds.

=head2 name

Str, lazy builds.

=head1 METHODS

=head2 _build_id

Returns the viewport's C<event_id_for('value')>

=head2 _build_name

Returns the viewport's C<event_id_for('value')>

=head1 FRAGMENTS

=head2 widget

Additional variables available in topic hash: "viewport", "id", "name".

Renders "label","field" and "message"

=head2 field

 C<content> will contain the value, if any,  of the field.

=head2 label

 C<content> will contain the label, if any, of the field.

=head2 message

 C<content> will contain the message, if any, of the field.

=head1 AUTHORS

See L<Reaction::Class> for authors.

=head1 LICENSE

See L<Reaction::Class> for the license.

=cut