Commit | Line | Data |
8f19d042 |
1 | package Reaction::UI::Widget::Field::ChooseOne; |
2 | |
3 | use Reaction::UI::WidgetClass; |
4 | |
5 | class ChooseOne is 'Reaction::UI::Widget::Field', which { |
6 | |
9de685fc |
7 | field renders [ option over func('viewport', 'value_choices') ], |
8 | { is_required => sub{ $_{viewport}->attribute->required } }; |
9 | |
10 | option renders [string {"DUMMY"}], |
11 | { |
12 | v_value => sub { $_->{value} }, |
13 | v_name => sub { $_->{name} }, |
14 | is_selected => sub { $_{viewport}->is_current_value($_->{value}) }, |
15 | }; |
8f19d042 |
16 | |
17 | }; |
18 | |
19 | 1; |
20 | |
6ab43711 |
21 | __END__; |
8f19d042 |
22 | |
5a1a893e |
23 | =head1 NAME |
8f19d042 |
24 | |
5a1a893e |
25 | Reaction::UI::Widget::Field::ChooseOne |
8f19d042 |
26 | |
5a1a893e |
27 | =head1 DESCRIPTION |
8f19d042 |
28 | |
5a1a893e |
29 | See L<Reaction::UI::Widget::Field> |
8f19d042 |
30 | |
5a1a893e |
31 | =head1 FRAGMENTS |
8f19d042 |
32 | |
5a1a893e |
33 | =head2 field |
8f19d042 |
34 | |
5a1a893e |
35 | Renders a series fragment C<option> for each C<value_choices> in the viewport |
8f19d042 |
36 | |
5a1a893e |
37 | Additional varibles set: C<is_required> - Boolean, self-explanatory |
8f19d042 |
38 | |
5a1a893e |
39 | =head2 option |
40 | |
41 | C<content> is a dummy variable, but th additional variables C<v_value>, C<v_name> |
42 | and C<is_selected> are set |
43 | |
44 | =head1 AUTHORS |
45 | |
46 | See L<Reaction::Class> for authors. |
47 | |
48 | =head1 LICENSE |
49 | |
50 | See L<Reaction::Class> for the license. |
8f19d042 |
51 | |
52 | =cut |