Commit | Line | Data |
8f19d042 |
1 | package Reaction::UI::Widget::Field; |
2 | |
3 | use Reaction::UI::WidgetClass; |
4 | |
bae75bee |
5 | use namespace::clean -except => [ qw(meta) ]; |
8f19d042 |
6 | |
bae75bee |
7 | |
8 | before fragment widget { |
9 | if ($_{viewport}->can('value_string')) { |
10 | arg 'field_value' => $_{viewport}->value_string; |
11 | } else { |
12 | arg 'field_value' => ''; #$_{viewport}->value; |
13 | } |
14 | }; |
15 | |
16 | implements fragment label_fragment { |
17 | if (my $label = $_{viewport}->label) { |
d219104c |
18 | arg label => localized $label; |
bae75bee |
19 | render 'label'; |
20 | } |
8f19d042 |
21 | }; |
22 | |
bae75bee |
23 | __PACKAGE__->meta->make_immutable; |
24 | |
25 | |
8f19d042 |
26 | 1; |
27 | |
6ab43711 |
28 | __END__; |
29 | |
5a1a893e |
30 | =head1 NAME |
31 | |
32 | Reaction::UI::Widget::Field |
33 | |
34 | =head1 DESCRIPTION |
35 | |
5a1a893e |
36 | =head1 FRAGMENTS |
37 | |
38 | =head2 widget |
39 | |
40 | Additional variables available in topic hash: "viewport", "id", "name". |
41 | |
42 | Renders "label","field" and "message" |
43 | |
44 | =head2 field |
45 | |
46 | C<content> will contain the value, if any, of the field. |
47 | |
48 | =head2 label |
49 | |
50 | C<content> will contain the label, if any, of the field. |
51 | |
52 | =head2 message |
53 | |
54 | C<content> will contain the message, if any, of the field. |
55 | |
56 | =head1 AUTHORS |
57 | |
58 | See L<Reaction::Class> for authors. |
59 | |
60 | =head1 LICENSE |
61 | |
62 | See L<Reaction::Class> for the license. |
63 | |
64 | =cut |