diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/Cobrand.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 21 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EmptyHomes.pm | 44 |
3 files changed, 50 insertions, 18 deletions
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm index b1ec6ba75..7d4382583 100644 --- a/perllib/Cobrand.pm +++ b/perllib/Cobrand.pm @@ -72,9 +72,6 @@ my %fns = ( 'extra_alert_data' => { default => "''" }, # Given a QUERY, extract any extra data required by the cobrand 'extra_data' => { default => "''" }, - # Given a QUERY, return a hash of extra params to be included in - # any URLs in links produced on the page returned by that query. - 'extra_params' => { default => "''" }, # Returns any extra text to be displayed with a PROBLEM. 'extra_problem_meta_text' => { default => "''" }, # Returns any extra text to be displayed with an UPDATE. diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 0613d0d6e..a2d1bc0bb 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -344,15 +344,6 @@ Given a QUERY, extract any extra data required by the cobrand sub extra_data { '' } -=head2 extra_params - -Given a QUERY, return a hash of extra params to be included in any URLs in links -produced on the page returned by that query. - -=cut - -sub extra_params { return {} } - =head2 extra_problem_meta_text Returns any extra text to be displayed with a PROBLEM. @@ -766,30 +757,30 @@ sub council_rss_alert_options { push @reported_to_options, { type => 'council', - id => sprintf( 'district:%s:%s', $district->{id}, $district->{id_name} ), + id => sprintf( 'council:%s:%s', $district->{id}, $district->{id_name} ), text => $district->{name}, rss_text => sprintf( _('RSS feed of %s'), $district->{name}), uri => $self->uri( '/rss/reports/' . $district->{short_name} ), }, { type => 'ward', - id => sprintf( 'd_ward:%s:%s:%s:%s', $district->{id}, $d_ward->{id}, $district->{id_name}, $d_ward->{id_name} ), + id => sprintf( 'ward:%s:%s:%s:%s', $district->{id}, $d_ward->{id}, $district->{id_name}, $d_ward->{id_name} ), rss_text => sprintf( _('RSS feed of %s, within %s ward'), $district->{name}, $d_ward->{name}), - text => sprintf( _('%s within, %s ward'), $district->{name}, $d_ward->{name}), + text => sprintf( _('%s, within %s ward'), $district->{name}, $d_ward->{name}), uri => $self->uri( '/rss/reports/' . $district->{short_name} . '/' . $d_ward->{short_name} ), }, { type => 'council', - id => sprintf( 'county:%s:%s', $county->{id}, $county->{id_name} ), + id => sprintf( 'council:%s:%s', $county->{id}, $county->{id_name} ), text => $county->{name}, rss_text => sprintf( _('RSS feed of %s'), $county->{name}), uri => $self->uri( '/rss/reports/' . $county->{short_name} ), }, { type => 'ward', - id => sprintf( 'c_ward:%s:%s:%s:%s', $county->{id}, $c_ward->{id}, $county->{id_name}, $c_ward->{id_name} ), + id => sprintf( 'ward:%s:%s:%s:%s', $county->{id}, $c_ward->{id}, $county->{id_name}, $c_ward->{id_name} ), rss_text => sprintf( _('RSS feed of %s, within %s ward'), $county->{name}, $c_ward->{name}), - text => sprintf( _('%s within, %s ward'), $county->{name}, $c_ward->{name}), + text => sprintf( _('%s, within %s ward'), $county->{name}, $c_ward->{name}), uri => $self->uri( '/rss/reports/' . $county->{short_name} . '/' . $c_ward->{short_name} ), }; diff --git a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm index c40ea5eb7..2199d660e 100644 --- a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm +++ b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm @@ -129,5 +129,49 @@ to be resized then return 0; sub default_photo_resize { return '195x'; } +=item council_rss_alert_options + +Generate a set of options for council rss alerts. + +=cut + +sub council_rss_alert_options { + my $self = shift; + my $all_councils = shift; + + my %councils = map { $_ => 1 } $self->area_types(); + + my $num_councils = scalar keys %$all_councils; + + my ( @options, @reported_to_options ); + my ($council, $ward); + foreach (values %$all_councils) { + $_->{short_name} = $self->short_name( $_ ); + ( $_->{id_name} = $_->{short_name} ) =~ tr/+/_/; + if ($_->{type} eq 'DIS') { + $council = $_; + } elsif ($_->{type} eq 'DIW') { + $ward = $_; + } + } + + push @options, { + type => 'council', + id => sprintf( 'council:%s:%s', $council->{id}, $council->{id_name} ), + text => sprintf( _('Problems within %s'), $council->{name}), + rss_text => sprintf( _('RSS feed of problems within %s'), $council->{name}), + uri => $self->uri( '/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 => $self->uri( '/rss/reports/' . $council->{short_name} . '/' . $ward->{short_name} ), + }; + + return ( \@options, @reported_to_options ? \@reported_to_options : undef ); +} + 1; |