Commit | Line | Data |
---|---|---|
2f670e13 | 1 | package Reaction::UI::Widget::Field::Collection; |
7b78a39d | 2 | |
3 | use Reaction::UI::WidgetClass; | |
4 | ||
bae75bee | 5 | use namespace::clean -except => [ qw(meta) ]; |
d7b00a50 | 6 | |
d7b00a50 | 7 | |
bae75bee | 8 | before fragment widget { |
d219104c | 9 | arg 'label' => localized $_{viewport}->label; |
bae75bee | 10 | }; |
d7b00a50 | 11 | |
bae75bee | 12 | implements fragment list { |
13 | render 'item' => over $_{viewport}->value_names; | |
14 | }; | |
d7b00a50 | 15 | |
bae75bee | 16 | implements fragment item { |
d219104c | 17 | arg 'name' => localized $_; |
7b78a39d | 18 | }; |
19 | ||
bae75bee | 20 | __PACKAGE__->meta->make_immutable; |
21 | ||
22 | ||
7b78a39d | 23 | 1; |
24 | ||
25 | __END__; | |
26 | ||
7b78a39d | 27 | |
5a1a893e | 28 | =head1 NAME |
7b78a39d | 29 | |
f9b32c83 | 30 | Reaction::UI::Widget::Field::Collection - A field representing a collection |
7b78a39d | 31 | |
5a1a893e | 32 | =head1 DESCRIPTION |
7b78a39d | 33 | |
f9b32c83 | 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 | ||
5a1a893e | 37 | =head1 FRAGMENTS |
7b78a39d | 38 | |
5a1a893e | 39 | =head2 widget |
7b78a39d | 40 | |
5a1a893e | 41 | renders C<label> and C<list> passing additional variable "viewport" |
7b78a39d | 42 | |
5a1a893e | 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 | ||
f9b32c83 | 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 | ||
5a1a893e | 100 | =head1 AUTHORS |
101 | ||
102 | See L<Reaction::Class> for authors. | |
103 | ||
104 | =head1 LICENSE | |
105 | ||
106 | See L<Reaction::Class> for the license. | |
7b78a39d | 107 | |
108 | =cut |