aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Cobrand/Barnet.pm81
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm17
2 files changed, 24 insertions, 74 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Barnet.pm b/perllib/FixMyStreet/Cobrand/Barnet.pm
index b3876a2c6..d33204521 100644
--- a/perllib/FixMyStreet/Cobrand/Barnet.pm
+++ b/perllib/FixMyStreet/Cobrand/Barnet.pm
@@ -1,14 +1,20 @@
package FixMyStreet::Cobrand::Barnet;
-use base 'FixMyStreet::Cobrand::UKCouncils';
+use mro 'c3';
+use parent 'FixMyStreet::Cobrand::FixMyStreet';
+use parent 'FixMyStreet::Cobrand::UKCouncils';
use strict;
use warnings;
+# As parent FixMyStreet has blank. XXX Do this better?
+sub restriction {
+ return { cobrand => 'barnet' };
+}
+
sub council_id { return 2489; }
sub council_area { return 'Barnet'; }
sub council_name { return 'Barnet Council'; }
sub council_url { return 'barnet'; }
-sub all_reports_style { return 'detailed'; }
sub path_to_web_templates {
my $self = shift;
@@ -29,77 +35,6 @@ sub disambiguate_location {
};
}
-sub generate_problem_banner {
- my ( $self, $problem ) = @_;
-
- my $banner = {};
- if ( $problem->is_open && time() - $problem->lastupdate_local->epoch > 8 * 7 * 24 * 60 * 60 )
- {
- $banner->{id} = 'unknown';
- $banner->{text} = _('Unknown');
- }
- if ($problem->is_fixed) {
- $banner->{id} = 'fixed';
- $banner->{text} = _('Fixed');
- }
- if ($problem->is_closed) {
- $banner->{id} = 'closed';
- $banner->{text} = _('Closed');
- }
-
- if ( grep { $problem->state eq $_ } ( 'investigating', 'in progress', 'planned' ) ) {
- $banner->{id} = 'progress';
- $banner->{text} = _('In progress');
- }
-
- return $banner;
-}
-
-sub council_rss_alert_options {
- my $self = shift;
- my $all_councils = shift;
- my $c = shift;
-
- my %councils = map { $_ => 1 } $self->area_types();
-
- my $num_councils = scalar keys %$all_councils;
-
- my ( @options, @reported_to_options );
- if ( $num_councils == 1 or $num_councils == 2 ) {
- my ($council, $ward);
- foreach (values %$all_councils) {
- if ($councils{$_->{type}}) {
- $council = $_;
- $council->{short_name} = $self->short_name( $council );
- ( $council->{id_name} = $council->{short_name} ) =~ tr/+/_/;
- } else {
- $ward = $_;
- $ward->{short_name} = $self->short_name( $ward );
- ( $ward->{id_name} = $ward->{short_name} ) =~ tr/+/_/;
- }
- }
-
- push @options,
- {
- type => 'council',
- id => sprintf( 'council:%s:%s', $council->{id}, $council->{id_name} ),
- text => 'All problems within the council.',
- rss_text => sprintf( _('RSS feed of problems within %s'), $council->{name}),
- uri => $c->uri_for( '/rss/reports/' . $council->{short_name} ),
- };
- push @options,
- {
- type => 'ward',
- id => sprintf( 'ward:%s:%s:%s:%s', $council->{id}, $ward->{id}, $council->{id_name}, $ward->{id_name} ),
- rss_text => sprintf( _('RSS feed of problems within %s ward'), $ward->{name}),
- text => sprintf( _('Problems within %s ward'), $ward->{name}),
- uri => $c->uri_for( '/rss/reports/' . $council->{short_name} . '/' . $ward->{short_name} ),
- } if $ward;
- }
-
- return ( \@options, @reported_to_options ? \@reported_to_options : undef );
-}
-
sub example_places {
return [ 'N11 1NP', 'Wood St' ];
}
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 2943c9ac4..5e8c9cb53 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -755,6 +755,13 @@ sub short_name {
}
+=item is_council
+
+For UK sub-cobrands, to specify various alternations needed for them.
+
+=cut
+sub is_council { 0; }
+
=item council_rss_alert_options
Generate a set of options for council rss alerts.
@@ -787,11 +794,18 @@ sub council_rss_alert_options {
$council->{name} = 'London Borough of Bromley'
if $council->{name} eq 'Bromley Council';
+ my $council_text;
+ if ( $c->cobrand->is_council ) {
+ $council_text = 'All problems within the council';
+ } else {
+ $council_text = sprintf( _('Problems within %s'), $council->{name});
+ }
+
push @options,
{
type => 'council',
id => sprintf( 'council:%s:%s', $council->{id}, $council->{id_name} ),
- text => sprintf( _('Problems within %s'), $council->{name}),
+ text => $council_text,
rss_text => sprintf( _('RSS feed of problems within %s'), $council->{name}),
uri => $c->uri_for( '/rss/reports/' . $council->{short_name} ),
};
@@ -803,6 +817,7 @@ sub council_rss_alert_options {
text => sprintf( _('Problems within %s ward'), $ward->{name}),
uri => $c->uri_for( '/rss/reports/' . $council->{short_name} . '/' . $ward->{short_name} ),
} if $ward;
+
} elsif ( $num_councils == 4 ) {
# # Two-tier council
my ($county, $district, $c_ward, $d_ward);