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