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 | |
8f19d042 |
21 | |
5a1a893e |
22 | =head1 NAME |
8f19d042 |
23 | |
5a1a893e |
24 | Reaction::UI::Widget::Field::ChooseOne |
8f19d042 |
25 | |
5a1a893e |
26 | =head1 DESCRIPTION |
8f19d042 |
27 | |
5a1a893e |
28 | See L<Reaction::UI::Widget::Field> |
8f19d042 |
29 | |
5a1a893e |
30 | =head1 FRAGMENTS |
8f19d042 |
31 | |
5a1a893e |
32 | =head2 field |
8f19d042 |
33 | |
5a1a893e |
34 | Renders a series fragment C<option> for each C<value_choices> in the viewport |
8f19d042 |
35 | |
5a1a893e |
36 | Additional varibles set: C<is_required> - Boolean, self-explanatory |
8f19d042 |
37 | |
5a1a893e |
38 | =head2 option |
39 | |
40 | C<content> is a dummy variable, but th additional variables C<v_value>, C<v_name> |
41 | and C<is_selected> are set |
42 | |
43 | =head1 AUTHORS |
44 | |
45 | See L<Reaction::Class> for authors. |
46 | |
47 | =head1 LICENSE |
48 | |
49 | See L<Reaction::Class> for the license. |
8f19d042 |
50 | |
51 | =cut |