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

use Reaction::UI::WidgetClass;

class ChooseOne is 'Reaction::UI::Widget::Field', which {

  field  renders [ option over func('viewport', 'value_choices') ],
    { is_required => sub{ $_{viewport}->attribute->required } };

  option renders [string {"DUMMY"}],
    {
     v_value  => sub { $_->{value} },
     v_name   => sub { $_->{name}  },
     is_selected => sub { $_{viewport}->is_current_value($_->{value}) },
    };

};

1;


=head1 NAME

Reaction::UI::Widget::Field::ChooseOne

=head1 DESCRIPTION

See L<Reaction::UI::Widget::Field>

=head1 FRAGMENTS

=head2 field

Renders a series fragment C<option> for each C<value_choices> in the viewport

Additional varibles set: C<is_required> - Boolean, self-explanatory

=head2 option

C<content> is a dummy variable, but th additional variables C<v_value>, C<v_name>
and C<is_selected> are set

=head1 AUTHORS

See L<Reaction::Class> for authors.

=head1 LICENSE

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

=cut