aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2016-04-15 17:49:13 +0100
committerDave Arter <davea@mysociety.org>2016-07-08 15:30:41 +0100
commit8a8b34b66dbdb9d2ce9c5b2d00318d75ef93d267 (patch)
tree94158b497072156c273f442ce19888665a205a2c /perllib/FixMyStreet/Cobrand
parent18b68734f0d425875a4e3abbd4416a7952d1089f (diff)
[UK Councils] Show all reports on cobrand /around map
There is a concern that excluding district council reports from a two-tier council's cobrand's /around page might lead to duplicate reports or reports never being seen. This commit adds them to the map and the sidebar and displays the destination council in the report list item. Clicking the pin or the report link leads to the report on FMS.com. Reports sent to the a council other than the the active cobrand are shown as grey pins on the map, and the receiving council's name is shown in the sidebar list.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand')
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm25
-rw-r--r--perllib/FixMyStreet/Cobrand/EastSussex.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Oxfordshire.pm1
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm7
4 files changed, 35 insertions, 0 deletions
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 ) = @_;