aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-06 16:46:03 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-06 16:46:03 +0000
commit71dbeae85dbef28b9af1954086bc5026de0fb3dd (patch)
tree7cb1eb15142e3787607495f090608d954ce38651 /perllib
parent8b835c38168228641666c1cf920fe94ce07be329 (diff)
Start of Zurich admin table sort ordering (DM).
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 4091bf4b0..578d077b2 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -195,18 +195,24 @@ sub admin {
my @children = map { $_->id } $body->bodies->all;
my @all = (@children, $body->id);
+ my $order = $c->req->params->{o} || 'created';
+ my $dir = $c->req->params->{d} || 1;
+ $c->stash->{order} = $order;
+ $c->stash->{dir} = $dir;
+ $order .= ' desc' if $dir;
+
# XXX No multiples or missing bodies
$c->stash->{unconfirmed} = $c->cobrand->problems->search({
state => [ 'unconfirmed', 'confirmed' ],
bodies_str => $c->stash->{body}->id,
}, {
- order_by => 'created'
+ order_by => $order,
});
$c->stash->{approval} = $c->cobrand->problems->search({
state => 'planned',
bodies_str => $c->stash->{body}->id,
}, {
- order_by => 'created'
+ order_by => $order,
});
my $page = $c->req->params->{p} || 1;