Revision 7dfa1a54
Von Sven Schöling vor etwa 11 Jahren hinzugefügt
SL/Controller/DeliveryPlan.pm | ||
---|---|---|
198 | 198 |
my ($self) = @_; |
199 | 199 |
|
200 | 200 |
SL::Controller::Helper::GetModels->new( |
201 |
controller => $self, |
|
202 |
model => 'OrderItem', |
|
203 |
filtered => { |
|
204 |
launder_to => 'filter', |
|
205 |
}, |
|
206 |
sorted => { |
|
207 |
_default => { |
|
208 |
by => 'reqdate', |
|
209 |
dir => 1, |
|
201 |
controller => $self, |
|
202 |
model => 'OrderItem', |
|
203 |
sorted => { |
|
204 |
_default => { |
|
205 |
by => 'reqdate', |
|
206 |
dir => 1, |
|
210 | 207 |
}, |
211 | 208 |
%sort_columns, |
212 | 209 |
}, |
213 |
query => $delivery_plan_query, |
|
210 |
query => $delivery_plan_query,
|
|
214 | 211 |
with_objects => [ 'order', 'order.customer', 'part' ], |
215 | 212 |
); |
216 | 213 |
} |
SL/Controller/Helper/GetModels/Base.pm | ||
---|---|---|
43 | 43 |
} |
44 | 44 |
|
45 | 45 |
1; |
46 |
|
|
47 |
__END__ |
|
48 |
|
|
49 |
=encoding utf-8 |
|
50 |
|
|
51 |
=head1 NAME |
|
52 |
|
|
53 |
SL::Controller::Helper::GetModels::Base - base class for GetModels plugins |
|
54 |
|
|
55 |
=head1 SYNOPSIS |
|
56 |
|
|
57 |
package SL::Controller::Helper::Getmodels::...; |
|
58 |
use parent 'SL::Controller::Helper::Getmodels::Base' |
|
59 |
|
|
60 |
sub read_params { ... } |
|
61 |
|
|
62 |
sub finalize { ... } |
|
63 |
|
|
64 |
=head1 DESCRIPTION |
|
65 |
|
|
66 |
This is a base class for plugins of the GetModels framework for controllers. It |
|
67 |
provides some common ground. |
|
68 |
|
|
69 |
=head1 FUNCTIONS |
|
70 |
|
|
71 |
=over 4 |
|
72 |
|
|
73 |
=back |
|
74 |
|
|
75 |
=head1 BUGS AND CAVEATS |
|
76 |
|
|
77 |
None yet :) |
|
78 |
|
|
79 |
=head1 AUTHOR |
|
80 |
|
|
81 |
Sven Schöling E<lt>s.schoeling@linet-services.deE<gt> |
|
82 |
|
|
83 |
=cut |
|
84 |
|
SL/Controller/Helper/GetModels/Sorted.pm | ||
---|---|---|
146 | 146 |
use SL::Controller::Helper::GetModels; |
147 | 147 |
use SL::Controller::Helper::Sorted; |
148 | 148 |
|
149 |
__PACKAGE__->make_sorted( |
|
149 |
__PACKAGE__->make_sorted( # update this
|
|
150 | 150 |
DEFAULT_BY => 'run_at', |
151 | 151 |
DEFAULT_DIR => 1, |
152 | 152 |
MODEL => 'BackgroundJobHistory', |
... | ... | |
170 | 170 |
|
171 | 171 |
<table> |
172 | 172 |
<tr> |
173 |
<th>[% L.sortable_table_header('package_name') %]</th> |
|
173 |
<th>[% L.sortable_table_header('package_name') %]</th> # models
|
|
174 | 174 |
<th>[% L.sortable_table_header('run_at') %]</th> |
175 | 175 |
<th>[% L.sortable_table_header('error') %]</th> |
176 | 176 |
</tr> |
... | ... | |
190 | 190 |
sortable list of database models with as few lines as possible. |
191 | 191 |
|
192 | 192 |
For this to work the controller has to provide the information which |
193 |
indexes are eligible for sorting etc. by a call to L<make_sorted> at |
|
193 |
indexes are eligible for sorting etc. by a call to L<make_sorted> at #not compiletime
|
|
194 | 194 |
compile time. |
195 | 195 |
|
196 | 196 |
The underlying functionality that enables the use of more than just |
... | ... | |
214 | 214 |
|
215 | 215 |
=over 4 |
216 | 216 |
|
217 |
=item C<make_sorted %sort_spec> |
|
217 |
=item C<make_sorted %sort_spec> # meh complete rewrite
|
|
218 | 218 |
|
219 | 219 |
This function must be called by a controller at compile time. It is |
220 | 220 |
uesd to set the various parameters required for this helper to do its |
SL/Controller/Project.pm | ||
---|---|---|
207 | 207 |
controller_class => 'Project', |
208 | 208 |
output_format => 'HTML', |
209 | 209 |
top_info_text => $::locale->text('Projects'), |
210 |
raw_bottom_info_text => $self->render('project/report_bottom', { output => 0 }), |
|
211 | 210 |
title => $::locale->text('Projects'), |
212 | 211 |
allow_pdf_export => 1, |
213 | 212 |
allow_csv_export => 1, |
... | ... | |
219 | 218 |
$self->models->disable_pagination if $report->{options}{output_format} =~ /^(pdf|csv)$/i; |
220 | 219 |
$self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable); |
221 | 220 |
$report->set_options( |
222 |
top_info_text => $::locale->text('Projects'), |
|
223 | 221 |
raw_bottom_info_text => $self->render('project/report_bottom', { output => 0 }), |
224 | 222 |
); |
225 | 223 |
} |
Auch abrufbar als: Unified diff
Bugs, Doku Stub