aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-05 15:48:32 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-05 16:07:55 +0000
commita57ad6b45d061754eb2497a642af3b94f0413b07 (patch)
tree9c8f7fa48f3cfcfdd15e565b3fcc6d618bee1711
parent1cbacdf3d0bdbe6696048260fc224cf9a6d691f9 (diff)
Default order, and paginate DM/SDM summary pages.
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm18
-rw-r--r--templates/web/zurich/admin/index-dm.html1
2 files changed, 18 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 3af086a24..366a1ff68 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -199,15 +199,25 @@ sub admin {
$c->stash->{unconfirmed} = $c->cobrand->problems->search({
state => [ 'unconfirmed', 'confirmed' ],
bodies_str => $c->stash->{body}->id,
+ }, {
+ order_by => 'created'
});
$c->stash->{approval} = $c->cobrand->problems->search({
state => 'planned',
bodies_str => $c->stash->{body}->id,
+ }, {
+ order_by => 'created'
});
+
+ my $page = $c->req->params->{p} || 1;
$c->stash->{other} = $c->cobrand->problems->search({
state => { -not_in => [ 'unconfirmed', 'confirmed', 'planned' ] },
bodies_str => \@all,
- });
+ }, {
+ order_by => 'created desc'
+ })->page( $page );
+ $c->stash->{pager} = $c->stash->{other}->pager;
+
} elsif ($type eq 'sdm') {
$c->stash->{template} = 'admin/index-sdm.html';
@@ -217,14 +227,20 @@ sub admin {
$c->stash->{reports_new} = $c->cobrand->problems->search( {
state => 'in progress',
bodies_str => $body->id,
+ }, {
+ order_by => 'created'
} );
$c->stash->{reports_unpublished} = $c->cobrand->problems->search( {
state => 'planned',
bodies_str => $body->parent->id,
+ }, {
+ order_by => 'created desc'
} );
$c->stash->{reports_published} = $c->cobrand->problems->search( {
state => 'fixed - council',
bodies_str => $body->parent->id,
+ }, {
+ order_by => 'created desc'
} );
}
}
diff --git a/templates/web/zurich/admin/index-dm.html b/templates/web/zurich/admin/index-dm.html
index a88100ee4..08634b5dd 100644
--- a/templates/web/zurich/admin/index-dm.html
+++ b/templates/web/zurich/admin/index-dm.html
@@ -11,6 +11,7 @@
<h2>[% loc('All reports') %]</h2>
[% INCLUDE list, problems = other.all, include_subdiv = 1 %]
+[% INCLUDE 'pagination.html', admin = 1, param = 'p' %]
[% INCLUDE 'admin/footer.html' %]