widget documentation
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Collection / Grid.pm
CommitLineData
2f670e13 1package Reaction::UI::Widget::Collection::Grid;
e22de101 2
3use Reaction::UI::WidgetClass;
4
bae75bee 5use namespace::clean -except => [ qw(meta) ];
6extends 'Reaction::UI::Widget::Collection';
e22de101 7
bae75bee 8implements fragment header_cells {
9 arg 'labels' => $_{viewport}->field_labels;
10 render header_cell => over $_{viewport}->computed_field_order;
f46fa4fd 11 if ($_{viewport}->member_action_count) {
12 render 'header_action_cell';
13 }
e22de101 14};
15
bae75bee 16implements fragment header_cell {
d219104c 17 arg label => localized $_{labels}->{$_};
bae75bee 18};
19
f46fa4fd 20implements fragment header_action_cell {
21 arg col_count => $_{viewport}->member_action_count;
22};
bae75bee 23
f46fa4fd 24__PACKAGE__->meta->make_immutable;
bae75bee 25
e22de101 261;
2dba7201 27
28__END__;
29
30=head1 NAME
31
f9b32c83 32Reaction::UI::Widget::Grid - A collection with header and footer
2dba7201 33
34=head1 DESCRIPTION
35
f9b32c83 36This widget is a subclass of L<Reaction::UI::Widget::Collection>. Additionally
37to its superclass, it provides abstract means of a header and a footer.
38
2dba7201 39=head1 FRAGMENTS
40
f9b32c83 41=head2 header_cells
42
43Will set the C<labels> argument to the viewport's C<field_labels> attribute
44value.
45
46Afterwards, the C<header_cell> fragment will be rendered once for every entry
47in the viewport's C<computed_field_order>.
48
49Additionally, the C<header_action_cell> will be rendered when the current
50viewport's C<member_action_count> is larger than 0.
51
52=head2 header_cell
53
54Populates the C<label> argument with a localised value of the C<labels>
55hash reference argument. The used key is extracted from the C<_> topic
56argument.
57
58=head2 header_action_cell
59
60Populates the C<col_count> argument with the viewports C<member_action_count>
61attribute value.
62
63=head1 LAYOUT SETS
64
65=head2 base
66
67 share/skin/base/layout/collection/grid.tt
68
69The base grid layout set does not provide an markup, just abstract layouting.
70
71The following layouts are provided:
72
73=over 4
74
75=item widget
76
77Renders, in sequence, the C<header>, C<body> and C<footer> fragments.
78
79=item header
80
81Renders the C<header_row> fragment.
82
83=item header_row
84
85Renders the C<header_cells> fragment.
86
87=item header_cell
88
89Renders the C<header_cell_contents> fragment.
90
91=item header_cell_contents
92
93Renders the value of the C<label> argument.
94
95=item header_action_cell
96
97Renders the string C<Actions>.
98
99=item body
100
101Renders the C<members> fragment implemented in L<Reaction::UI::Widget::Collection>.
102
103=back
104
105=head2 default
106
107 share/skin/default/layout/collection/grid.tt
108
109This layout set extends the C<NEXT> in the skin inheritance hierarchy.
110
111It is meant to extend upon the layout set with the same name in the C<base> skin and
112provides the same abstract structure but with a table based markup.
113
114The following layouts are provided:
115
116=over 4
117
118=item widget
119
120Renders the next skin's C<widget> fragment surrounded by a C<table> element with the
121class attribute C<grid>.
122
123=item header
124
125Renders the next skin's C<header> fragment surrounded by a C<thead> element.
126
127=item header_row
128
129Wrap's the next skin's C<header_row> fragment in a C<tr> element.
130
131=item header_cell
132
133Wrap's the next skin's C<header_cell> fragment in a C<th> element.
134
135=item header_action_cell
136
137Wrap's the next skin's C<header_action_cell> fragment in a C<th> element with a C<colspan>
138attribute set to the number of actions found in the C<col_count> attribute
139
140=item body
141
142Wrap's the next skin's C<body> fragment in a C<tbody> element.
143
144=back
145
146=head1 SEE ALSO
147
148=over 4
149
150=item * L<Reaction::UI::Widget::Collection>
151
152=item * L<Reaction::UI::Widget::Collection::Grid::Member>
153
154=back
155
2dba7201 156=head1 AUTHORS
157
158See L<Reaction::Class> for authors.
159
160=head1 LICENSE
161
162See L<Reaction::Class> for the license.
163
164=cut