aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm14
-rw-r--r--perllib/FixMyStreet/App/Controller/My.pm8
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm5
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm46
4 files changed, 44 insertions, 29 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index ec84ca09a..1f45f8029 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -181,7 +181,7 @@ sub display_location : Private {
my ( $on_map_all, $on_map, $nearby, $distance ) =
FixMyStreet::Map::map_features( $c,
latitude => $latitude, longitude => $longitude,
- interval => $interval, category => $c->stash->{filter_category},
+ interval => $interval, categories => $c->stash->{filter_category},
states => $c->stash->{filter_problem_states} );
# copy the found reports to the stash
@@ -258,13 +258,11 @@ sub check_and_stash_category : Private {
)->all;
my @categories = map { $_->category } @contacts;
$c->stash->{filter_categories} = \@categories;
-
-
- my $category = $c->get_param('filter_category');
my %categories_mapped = map { $_ => 1 } @categories;
- if ( defined $category && $categories_mapped{$category} ) {
- $c->stash->{filter_category} = $category;
- }
+
+ my $categories = [ $c->get_param_list('filter_category', 1) ];
+ my @valid_categories = grep { $_ && $categories_mapped{$_} } @$categories;
+ $c->stash->{filter_category} = \@valid_categories;
}
=head2 /ajax
@@ -303,7 +301,7 @@ sub ajax : Path('/ajax') {
my ( $on_map_all, $on_map_list, $nearby, $dist ) =
FixMyStreet::Map::map_features($c,
bbox => $bbox, interval => $interval,
- category => $c->get_param('filter_category'),
+ categories => [ $c->get_param_list('filter_category', 1) ],
states => $c->stash->{filter_problem_states} );
# create a list of all the pins
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm
index b7fabcf4c..573c41446 100644
--- a/perllib/FixMyStreet/App/Controller/My.pm
+++ b/perllib/FixMyStreet/App/Controller/My.pm
@@ -63,10 +63,10 @@ sub get_problems : Private {
state => [ keys %$states ],
};
- my $category = $c->get_param('filter_category');
- if ( $category ) {
- $params->{category} = $category;
- $c->stash->{filter_category} = $category;
+ my $categories = [ $c->get_param_list('filter_category', 1) ];
+ if ( @$categories ) {
+ $params->{category} = $categories;
+ $c->stash->{filter_category} = $categories;
}
my $rs = $c->stash->{problems_rs}->search( $params, {
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 75f54facf..b3b5d00fd 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -1242,9 +1242,12 @@ sub redirect_to_around : Private {
lat => $c->stash->{latitude},
lon => $c->stash->{longitude},
};
- foreach (qw(pc zoom status filter_category)) {
+ foreach (qw(pc zoom)) {
$params->{$_} = $c->get_param($_);
}
+ foreach (qw(status filter_category)) {
+ $params->{$_} = join(',', $c->get_param_list($_, 1));
+ }
# delete empty values
for ( keys %$params ) {
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 49f477fec..60a7d1726 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -132,7 +132,7 @@ sub ward : Path : Args(2) {
} )->all;
@categories = map { $_->category } @categories;
$c->stash->{filter_categories} = \@categories;
- $c->stash->{filter_category} = $c->get_param('filter_category');
+ $c->stash->{filter_category} = [ $c->get_param_list('filter_category', 1) ];
my $pins = $c->stash->{pins};
@@ -464,23 +464,37 @@ sub redirect_body : Private {
sub stash_report_filter_status : Private {
my ( $self, $c ) = @_;
- my $status = $c->get_param('status') || $c->cobrand->on_map_default_status;
- if ( $status eq 'all' ) {
- $c->stash->{filter_status} = 'all';
- $c->stash->{filter_problem_states} = FixMyStreet::DB::Result::Problem->visible_states();
- } elsif ( $status eq 'open' ) {
- $c->stash->{filter_status} = 'open';
- $c->stash->{filter_problem_states} = FixMyStreet::DB::Result::Problem->open_states();
- } elsif ( $status eq 'closed' ) {
- $c->stash->{filter_status} = 'closed';
- $c->stash->{filter_problem_states} = FixMyStreet::DB::Result::Problem->closed_states();
- } elsif ( $status eq 'fixed' ) {
- $c->stash->{filter_status} = 'fixed';
- $c->stash->{filter_problem_states} = FixMyStreet::DB::Result::Problem->fixed_states();
- } else {
- $c->stash->{filter_status} = $c->cobrand->on_map_default_status;
+ my @status = $c->get_param_list('status', 1);
+ @status = ($c->cobrand->on_map_default_status) unless @status;
+ my %status = map { $_ => 1 } @status;
+
+ my %filter_problem_states;
+ my %filter_status;
+
+ if ($status{open}) {
+ my $s = FixMyStreet::DB::Result::Problem->open_states();
+ %filter_problem_states = (%filter_problem_states, %$s);
+ $filter_status{open} = 1;
+ }
+ if ($status{closed}) {
+ my $s = FixMyStreet::DB::Result::Problem->closed_states();
+ %filter_problem_states = (%filter_problem_states, %$s);
+ $filter_status{closed} = 1;
+ }
+ if ($status{fixed}) {
+ my $s = FixMyStreet::DB::Result::Problem->fixed_states();
+ %filter_problem_states = (%filter_problem_states, %$s);
+ $filter_status{fixed} = 1;
+ }
+
+ if ($status{all}) {
+ my $s = FixMyStreet::DB::Result::Problem->visible_states();
+ # %filter_status = ();
+ %filter_problem_states = %$s;
}
+ $c->stash->{filter_problem_states} = \%filter_problem_states;
+ $c->stash->{filter_status} = \%filter_status;
return 1;
}