1 package Reaction::UI::Widget::Field::Mutable::ChooseOne;
3 use Reaction::UI::WidgetClass;
5 use namespace::clean -except => [ qw(meta) ];
6 extends 'Reaction::UI::Widget::Field::Mutable';
10 implements fragment option_is_required {
11 if ($_{viewport}->value_is_required) {
12 render 'option_is_required_yes';
14 render 'option_is_required_no';
18 implements fragment option_list {
19 render option => over $_{viewport}->value_choices;
22 implements fragment option {
23 arg option_name => $_->{name};
24 arg option_value => $_->{value};
27 implements fragment option_is_selected {
28 if ($_{viewport}->is_current_value($_->{value})) {
29 render 'option_is_selected_yes';
31 render 'option_is_selected_no';
35 __PACKAGE__->meta->make_immutable;
44 Reaction::UI::Widget::Field::Mutable::ChooseOne - Choose one from a list of available values
48 See L<Reaction::UI::Widget::Field::Mutable>. This widget provides the user with a
49 field where he can select a single value from a list of many.
55 Renders a series fragment C<option> for each C<value_choices> in the viewport
57 Additional varibles set: C<is_required> - Boolean, self-explanatory
61 C<content> is a dummy variable, but th additional variables C<v_value>, C<v_name>
62 and C<is_selected> are set
64 =head2 option_is_required
66 Renders either C<option_is_required_yes> or C<option_is_required_no> depending on
67 the viewport's C<value_is_required> attribute.
71 Renders the C<option> fragment over the viewport's C<value_choices>. This populates
72 the list of available values.
74 =head2 option_is_selected
76 Renders either C<option_is_selected_yes> or C<option_is_selected_no> depending on
77 if the viewport's C<is_current_value> method returns true on the current topic
78 arguments C<value> key.
84 share/skin/base/layout/field/mutable/choose_one.tt
86 This layout set renders a C<select> element with the available values as C<option>s.
90 See L<Reaction::Class> for authors.
94 See L<Reaction::Class> for the license.