aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/Widget/Field.pm
blob: 4d91afa69ce4dcc2d0fb893b213289a79ba14dad (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
package Reaction::UI::Widget::Field;

use Reaction::UI::WidgetClass;

class Field, which {

  before fragment widget {
    if ($_{viewport}->can('value_string')) {
      arg 'field_value' => $_{viewport}->value_string;
    } else {
      arg 'field_value' => $_{viewport}->value;
    }
  };

  implements fragment label_fragment {
    if (my $label = $_{viewport}->label) {
      arg label => $label;
      render 'label';
    }
  };

};

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