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