1 package Reaction::UI::Widget::ListView;
3 use Reaction::UI::WidgetClass;
5 class ListView is 'Reaction::UI::Widget::Collection::Grid', which {
7 after fragment widget {
8 arg pager_obj => $_{viewport}->pager;
11 implements fragment actions {
12 render action => over $_{viewport}->actions;
15 implements fragment action {
19 after fragment header_cells {
20 if ($_{viewport}->object_action_count) {
21 render 'header_action_cell';
25 around fragment header_cell {
26 arg order_uri => event_uri {
28 order_by_desc => ((($_{viewport}->order_by||'') ne $_
29 || $_{viewport}->order_by_desc) ? 0 : 1)
34 implements fragment header_action_cell {
35 arg col_count => $_{viewport}->object_action_count;
38 implements fragment page_list {
39 render numbered_page_fragment
40 => over [ $_{pager_obj}->first_page .. $_{pager_obj}->last_page ];
43 implements fragment numbered_page_fragment {
44 arg page_uri => event_uri { page => $_ };
45 arg page_number => $_;
46 if ($_{pager_obj}->current_page == $_) {
47 render 'numbered_page_this_page';
49 render 'numbered_page';
53 implements fragment first_page {
54 arg page_uri => event_uri { page => $_{pager_obj}->first_page };
55 arg page_name => 'First';
59 implements fragment last_page {
60 arg page_uri => event_uri { page => $_{pager_obj}->last_page };
61 arg page_name => 'Last';
65 implements fragment next_page {
66 arg page_name => 'Next';
67 if (my $page = $_{pager_obj}->next_page) {
68 arg page_uri => event_uri { page => $page };
71 render 'named_page_no_page';
75 implements fragment previous_page {
76 arg page_name => 'Previous';
77 if (my $page = $_{pager_obj}->previous_page) {
78 arg page_uri => event_uri { page => $page };
81 render 'named_page_no_page';
93 Reaction::UI::Widget::ListView
97 This class is a subclass of L<Reaction::UI::ViewPort::Collection::Grid>
103 Additional arguments available:
107 =item B<pager_obj> - The C<pager> object of the viewport
113 Render the C<action> fragment for every action in the viewport.
117 Renders the C<action> viewport passed
121 Adds a modifier to render the actions column after the data columns
125 Modify the header_cell fragment to add support for ordering
127 Additional arguments available:
131 =item B<order_uri> - A URI to the collection view which will order the members
132 using this field. Will toggle ascending / descending order.
136 =head2 header_action_cell
138 Additional arguments available:
142 =item B<col_count> - Column width to span
148 Will sequentially render a C<numbered_page_fragment> for every page available in
151 =head2 numbered_page_fragment
153 Renders a link pointing to the different pages in the pager object. If the current
154 page number is equal to the page number for the page being rendered then the
155 template block C<numbered_page_this_page> is called instead of C<numbered_page>
157 Additional arguments available:
161 =item B<page_uri> - The URI to the page
163 =item B<page_number> - The number of the page
175 Render links to the first, last, next and previous pages, respectively. All four will
176 render as the C<named_page> template fragment, unless the current page is the last
177 and/or first page, in which case the first and last fragments will render as
178 C<named_page_no_page>
180 Additional arguments available:
184 =item B<page_uri> - The URI to the page
186 =item B<page_number> - The label of the page (First / Last / Next / Previous)
193 See L<Reaction::Class> for authors.
197 See L<Reaction::Class> for the license.