aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-06-28 17:15:39 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-06-28 17:15:39 +0100
commit91e9552a11f9861d1c43a3a1315d322bae76dd00 (patch)
treeda023a3a3ced5c0132e8fae90e46483739340f81 /perllib/FixMyStreet/App
parentec4f9183efc96f33e4cbd0388acd6e5d5654ad74 (diff)
Pagination of reports/updates.
Diffstat (limited to 'perllib/FixMyStreet/App')
-rw-r--r--perllib/FixMyStreet/App/Controller/My.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm
index 74f7a6d52..b1359ae03 100644
--- a/perllib/FixMyStreet/App/Controller/My.pm
+++ b/perllib/FixMyStreet/App/Controller/My.pm
@@ -28,9 +28,15 @@ sub my : Path : Args(0) {
# Even though front end doesn't yet have it, have it on this page, it's better!
FixMyStreet::Map::set_map_class( 'FMS' );
+ my $p_page = $c->req->params->{p} || 1;
+ my $u_page = $c->req->params->{u} || 1;
+
my $pins = [];
my $problems = {};
- foreach my $problem ( $c->user->problems ) {
+ my $rs = $c->user->problems->search( undef,
+ { rows => 50 } )->page( $p_page );
+
+ while ( my $problem = $rs->next ) {
push @$pins, {
latitude => $problem->latitude,
longitude => $problem->longitude,
@@ -40,12 +46,15 @@ sub my : Path : Args(0) {
};
push @{ $problems->{$problem->state} }, $problem;
}
-
+ $c->stash->{problems_pager} = $rs->pager;
$c->stash->{problems} = $problems;
- my @updates = $c->user->comments->search( {
- state => 'confirmed',
- } )->all;
+
+ $rs = $c->user->comments->search(
+ { state => 'confirmed' },
+ { rows => 50 } )->page( $u_page );
+ my @updates = $rs->all;
$c->stash->{updates} = \@updates;
+ $c->stash->{updates_pager} = $rs->pager;
FixMyStreet::Map::display_map(
$c,