diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 25 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EastSussex.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 7 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map.pm | 4 |
6 files changed, 38 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index b8f038ce3..f8ea84d08 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -195,6 +195,7 @@ sub display_location : Private { colour => $colour, id => $p->id, title => $p->title_safe, + problem => $p, } } @$on_map_all, @$around_map; } diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 65c97f38b..36313cf63 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -74,6 +74,18 @@ sub problems { return $self->problems_restriction($self->{c}->model('DB::Problem')); } +=head1 problems_on_map + +Returns a ResultSet of Problems to be shown on the /around map, potentially +restricted to a subset if we're on a cobrand that only wants some of the data. + +=cut + +sub problems_on_map { + my $self = shift; + return $self->problems_on_map_restriction($self->{c}->model('DB::Problem')); +} + =head1 updates Returns a ResultSet of Comments, potentially restricted to a subset if we're on @@ -115,6 +127,19 @@ sub categories_restriction { return $rs; } + +=head1 problems_on_map_restriction + +Used to restricts reports shown on the /around map in a cobrand in a particular way. Do +nothing by default. + +=cut + +sub problems_on_map_restriction { + my ($self, $rs) = @_; + return $rs; +} + sub site_key { return 0; } =head2 restriction diff --git a/perllib/FixMyStreet/Cobrand/EastSussex.pm b/perllib/FixMyStreet/Cobrand/EastSussex.pm index 2ba3a4f70..80a86706a 100644 --- a/perllib/FixMyStreet/Cobrand/EastSussex.pm +++ b/perllib/FixMyStreet/Cobrand/EastSussex.pm @@ -113,6 +113,8 @@ sub reports_per_page { return 20; } sub pin_colour { my ( $self, $p, $context ) = @_; + return 'grey' unless $self->owns_problem( $p ); + # TODO refactor to a Moo(se)? lazy attribute my $open_states = $self->{open_states} ||= $p->open_states; diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index 3b044369e..d127f5e13 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -98,6 +98,7 @@ sub reports_ordering { sub pin_colour { my ( $self, $p, $context ) = @_; + return 'grey' unless $self->owns_problem( $p ); return 'grey' if $p->state eq 'not responsible'; return 'green' if $p->is_fixed || $p->is_closed; return 'red' if $p->state eq 'confirmed'; diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 6bf70e091..6e98f4ae0 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -129,6 +129,13 @@ sub owns_problem { return $areas{$self->council_id} ? 1 : undef; } +# If the council is two-tier then show pins for the other council as grey +sub pin_colour { + my ( $self, $p, $context ) = @_; + return 'grey' if $self->is_two_tier && !$self->owns_problem( $p ); + return $self->next::method($p, $context); +} + # If we ever link to a county problem report, needs to be to main FixMyStreet sub base_url_for_report { my ( $self, $report ) = @_; diff --git a/perllib/FixMyStreet/Map.pm b/perllib/FixMyStreet/Map.pm index 6d641331f..b8b128611 100644 --- a/perllib/FixMyStreet/Map.pm +++ b/perllib/FixMyStreet/Map.pm @@ -100,9 +100,9 @@ sub _map_features { my $around_limit = $c->cobrand->on_map_list_limit || undef; my @around_args = ( $min_lat, $max_lat, $min_lon, $max_lon, $interval ); - my $around_map = $c->cobrand->problems->around_map( @around_args, undef, $category, $states ); + my $around_map = $c->cobrand->problems_on_map->around_map( @around_args, undef, $category, $states ); my $around_map_list = $around_limit - ? $c->cobrand->problems->around_map( @around_args, $around_limit, $category, $states ) + ? $c->cobrand->problems_on_map->around_map( @around_args, $around_limit, $category, $states ) : $around_map; my $dist = FixMyStreet::Gaze::get_radius_containing_population( $lat, $lon ); |