aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2015-02-18 11:28:10 +0000
committerSteven Day <steve@mysociety.org>2015-06-29 12:43:00 +0100
commit16866effa254c4a8dcac560fb0c9446a62025b6f (patch)
tree1c205a5fa6d3f7cdf654ee664b6e6cff6ea23252 /perllib
parent1df64a30dd0939d8d9b8b1854f7f7e421d9b20ab (diff)
Allow cobrands to specify ordering on all reports page
Refactor the default ordering into a method on the Default cobrand which can be overridden by subclasses.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm10
2 files changed, 11 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 352c47da8..8d7a7acbd 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -430,7 +430,7 @@ sub load_and_group_problems : Private {
my $problems = $c->cobrand->problems->search(
$where,
{
- order_by => { -desc => 'lastupdate' },
+ order_by => $c->cobrand->reports_ordering,
rows => $c->cobrand->reports_per_page,
}
)->page( $page );
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index abf5d4fb5..228865c78 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -340,6 +340,16 @@ sub reports_per_page {
return FixMyStreet->config('ALL_REPORTS_PER_PAGE') || 100;
}
+=head2 reports_ordering
+
+The order_by clause to use for reports on all reports page
+
+=cut
+
+sub reports_ordering {
+ return { -desc => 'lastupdate' };
+}
+
=head2 on_map_list_limit
Return the maximum number of items to be given in the list of reports on the map