aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Reports.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-06-12 17:46:47 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-07-03 15:55:52 +0100
commit1b7418e2aec2ce269fde49efcff8493e4e24ad7e (patch)
tree2761dc4196b1c5f306b4e498ee633a5e939f2d9b /perllib/FixMyStreet/App/Controller/Reports.pm
parent04e49afc9a7c10405464c62b0cfd6f6c55b286ac (diff)
Only display reports from last 6 months on around.
Add a checkbox to show older reports, plus if we get to the end of the new reports then instead of a Next button show a "show older" button that will reload the current page but with older reports also loaded. Wire it all up into the pushState code as well.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Reports.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index dc9e2c913..05776a94f 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -758,10 +758,13 @@ sub stash_report_sort : Private {
$sort =~ /^(updated|created|comments)-(desc|asc)$/;
my $order_by = $types{$1} || $1;
+ # field to use for report age cutoff
+ $c->stash->{report_age_field} = $order_by eq 'comment_count' ? 'lastupdate' : $order_by;
my $dir = $2;
$order_by = { -desc => $order_by } if $dir eq 'desc';
$c->stash->{sort_order} = $order_by;
+
return 1;
}