1 package Reaction::UI::Widget::Collection::Grid;
3 use Reaction::UI::WidgetClass;
5 use namespace::clean -except => [ qw(meta) ];
6 extends 'Reaction::UI::Widget::Collection';
8 implements fragment header_cells {
9 arg 'labels' => $_{viewport}->field_labels;
10 render header_cell => over $_{viewport}->computed_field_order;
11 if ($_{viewport}->member_action_count) {
12 render 'header_action_cell';
16 implements fragment header_cell {
17 arg label => localized $_{labels}->{$_};
20 implements fragment header_action_cell {
21 arg col_count => $_{viewport}->member_action_count;
24 __PACKAGE__->meta->make_immutable;
32 Reaction::UI::Widget::Collection::Grid - A collection with header and footer
36 This widget is a subclass of L<Reaction::UI::Widget::Collection>. Additionally
37 to its superclass, it provides abstract means of a header and a footer.
43 Will set the C<labels> argument to the viewport's C<field_labels> attribute
46 Afterwards, the C<header_cell> fragment will be rendered once for every entry
47 in the viewport's C<computed_field_order>.
49 Additionally, the C<header_action_cell> will be rendered when the current
50 viewport's C<member_action_count> is larger than 0.
54 Populates the C<label> argument with a localised value of the C<labels>
55 hash reference argument. The used key is extracted from the C<_> topic
58 =head2 header_action_cell
60 Populates the C<col_count> argument with the viewports C<member_action_count>
67 share/skin/base/layout/collection/grid.tt
69 The base grid layout set does not provide an markup, just abstract layouting.
71 The following layouts are provided:
77 Renders, in sequence, the C<header>, C<body> and C<footer> fragments.
81 Renders the C<header_row> fragment.
85 Renders the C<header_cells> fragment.
89 Renders the C<header_cell_contents> fragment.
91 =item header_cell_contents
93 Renders the value of the C<label> argument.
95 =item header_action_cell
97 Renders the string C<Actions>.
101 Renders the C<members> fragment implemented in L<Reaction::UI::Widget::Collection>.
107 share/skin/default/layout/collection/grid.tt
109 This layout set extends the C<NEXT> in the skin inheritance hierarchy.
111 It is meant to extend upon the layout set with the same name in the C<base> skin and
112 provides the same abstract structure but with a table based markup.
114 The following layouts are provided:
120 Renders the next skin's C<widget> fragment surrounded by a C<table> element with the
121 class attribute C<grid>.
125 Renders the next skin's C<header> fragment surrounded by a C<thead> element.
129 Wrap's the next skin's C<header_row> fragment in a C<tr> element.
133 Wrap's the next skin's C<header_cell> fragment in a C<th> element.
135 =item header_action_cell
137 Wrap's the next skin's C<header_action_cell> fragment in a C<th> element with a C<colspan>
138 attribute set to the number of actions found in the C<col_count> attribute
142 Wrap's the next skin's C<body> fragment in a C<tbody> element.
150 =item * L<Reaction::UI::Widget::Collection>
152 =item * L<Reaction::UI::Widget::Collection::Grid::Member>
158 See L<Reaction::Class> for authors.
162 See L<Reaction::Class> for the license.