Object consumes Action and Collection consumes Pager and Action, so Member::WithActio...
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Field / Collection.pm
CommitLineData
2f670e13 1package Reaction::UI::Widget::Field::Collection;
7b78a39d 2
3use Reaction::UI::WidgetClass;
4
bae75bee 5use namespace::clean -except => [ qw(meta) ];
d7b00a50 6
d7b00a50 7
bae75bee 8before fragment widget {
d219104c 9 arg 'label' => localized $_{viewport}->label;
bae75bee 10};
d7b00a50 11
bae75bee 12implements fragment list {
13 render 'item' => over $_{viewport}->value_names;
14};
d7b00a50 15
bae75bee 16implements fragment item {
d219104c 17 arg 'name' => localized $_;
7b78a39d 18};
19
bae75bee 20__PACKAGE__->meta->make_immutable;
21
22
7b78a39d 231;
24
25__END__;
26
7b78a39d 27
5a1a893e 28=head1 NAME
7b78a39d 29
f9b32c83 30Reaction::UI::Widget::Field::Collection - A field representing a collection
7b78a39d 31
5a1a893e 32=head1 DESCRIPTION
7b78a39d 33
f9b32c83 34This field class will render a collection of values found in the viewport's
35C<value_names> and localised before passed to the layout.
36
5a1a893e 37=head1 FRAGMENTS
7b78a39d 38
5a1a893e 39=head2 widget
7b78a39d 40
5a1a893e 41renders C<label> and C<list> passing additional variable "viewport"
7b78a39d 42
5a1a893e 43=head2 label
44
45C<content> contains the viewport's label
46
47=head2 list
48
49renders fragment item over the viewport's C<value_names>
50
51=head2 item
52
53C<content> contains the value of the current item ($_ / $_{_})
54
f9b32c83 55=head1 LAYOUT SETS
56
57=head2 base
58
59 share/skin/base/layout/field/collection.tt
60
61The following layouts are provided:
62
63=over 4
64
65=item widget
66
67Renders the C<label_box> and C<list> fragments.
68
69=item label_box
70
71Renders a C<span> element containing the C<label> argument.
72
73=item list
74
75Renders the C<item>s inside a C<div> and C<ul> element.
76
77=item item
78
79Renders the C<name> argument inside a C<li> element.
80
81=back
82
83=head2 default
84
85 share/skin/default/layout/field/collection.tt
86
87This layout set extends the C<NEXT> one in the parent skin.
88
89The following layouts are provided:
90
91=over 4
92
93=item label_box
94
95The same as in the C<base> skin, except the label is surrounded by
96a C<strong> element.
97
98=back
99
5a1a893e 100=head1 AUTHORS
101
102See L<Reaction::Class> for authors.
103
104=head1 LICENSE
105
106See L<Reaction::Class> for the license.
7b78a39d 107
108=cut