aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/Widget/Field/ChooseMany.pm
blob: efb100d98876188e932a4839ff4c71650c00e081 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package Reaction::UI::Widget::Field::ChooseMany;

use Reaction::UI::WidgetClass;

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

  implements fragment action_buttons {
    foreach my $event (
      qw(add_all_values do_add_values do_remove_values remove_all_values)
        ) {
      arg "event_id_${event}" => event_id $event;
    }
  };

  implements fragment current_values {
    render hidden_value => over $_{viewport}->current_value_choices;
  };

  implements fragment selected_values {
    arg event_id_remove_values => event_id 'remove_values';
    render value_option => over $_{viewport}->current_value_choices;
  };

  implements fragment available_values {
    arg event_id_add_values => event_id 'add_values';
    render value_option => over $_{viewport}->available_value_choices;
  };

  implements fragment value_option {
    arg option_name => $_->{name};
    arg option_value => $_->{value};
  };

  implements fragment hidden_value {
    arg hidden_value => $_->{value};
  };

};

1;

__END__;

=head1 NAME

Reaction::UI::Widget::Field::ChooseMany

=head1 DESCRIPTION

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

This needs a refactor to not be tied to a dual select box, but ENOTIME

=head1 FRAGMENTS

=head2 field

renders C<available_values>, C<action_buttons>, C<selected_values> and C<current_values>

=head2 current values

renders the viewport's current_value_choices over hidden_value

=head2 hidden_value

C<content> is the value of the current choice

=head2 available_value

rendersthe viewport's current_available_value_choices over the option fragment

=head2 selected_value

rendersthe viewport's current_selected_value_choices over the option fragment

=head2 option

C<content> is a dummy value but C<v_value> and C<v_name> are both set.

=head1 AUTHORS

See L<Reaction::Class> for authors.

=head1 LICENSE

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

=cut