diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/My.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/My.pm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm index bbef1f8d8..8e55b4371 100644 --- a/perllib/FixMyStreet/App/Controller/My.pm +++ b/perllib/FixMyStreet/App/Controller/My.pm @@ -28,11 +28,26 @@ sub my : Path : Args(0) { my $p_page = $c->req->params->{p} || 1; my $u_page = $c->req->params->{u} || 1; + my $states = $c->cobrand->on_map_default_states; + $c->stash->{filter_status} = $c->cobrand->on_map_default_status; + my $status = $c->req->param('status') || ''; + if ( !defined $states || $status eq 'all' ) { + $states = FixMyStreet::DB::Result::Problem->visible_states(); + $c->stash->{filter_status} = 'all'; + } elsif ( $status eq 'open' ) { + $states = FixMyStreet::DB::Result::Problem->open_states(); + $c->stash->{filter_status} = 'open'; + } elsif ( $status eq 'fixed' ) { + $states = FixMyStreet::DB::Result::Problem->fixed_states(); + $c->stash->{filter_status} = 'fixed'; + } + my $pins = []; my $problems = {}; + my $params = { - state => [ FixMyStreet::DB::Result::Problem->visible_states() ], + state => [ keys %$states ], }; $params = { %{ $c->cobrand->problems_clause }, @@ -55,6 +70,7 @@ sub my : Path : Args(0) { }; my $state = $problem->is_fixed ? 'fixed' : $problem->is_closed ? 'closed' : 'confirmed'; push @{ $problems->{$state} }, $problem; + push @{ $problems->{all} }, $problem; } $c->stash->{problems_pager} = $rs->pager; $c->stash->{problems} = $problems; |