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