more work towards widgets, split up the templates and added some super basic POD
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Field / ChooseOne.pm
CommitLineData
8f19d042 1package Reaction::UI::Widget::Field::ChooseOne;
2
3use Reaction::UI::WidgetClass;
4
5class 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
191;
20
8f19d042 21
5a1a893e 22=head1 NAME
8f19d042 23
5a1a893e 24Reaction::UI::Widget::Field::ChooseOne
8f19d042 25
5a1a893e 26=head1 DESCRIPTION
8f19d042 27
5a1a893e 28See L<Reaction::UI::Widget::Field>
8f19d042 29
5a1a893e 30=head1 FRAGMENTS
8f19d042 31
5a1a893e 32=head2 field
8f19d042 33
5a1a893e 34Renders a series fragment C<option> for each C<value_choices> in the viewport
8f19d042 35
5a1a893e 36Additional varibles set: C<is_required> - Boolean, self-explanatory
8f19d042 37
5a1a893e 38=head2 option
39
40C<content> is a dummy variable, but th additional variables C<v_value>, C<v_name>
41and C<is_selected> are set
42
43=head1 AUTHORS
44
45See L<Reaction::Class> for authors.
46
47=head1 LICENSE
48
49See L<Reaction::Class> for the license.
8f19d042 50
51=cut