diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Body.pm | 16 | ||||
-rw-r--r-- | templates/web/base/report/new/form_user_loggedin.html | 2 | ||||
-rw-r--r-- | templates/web/base/reports/_rss.html | 5 |
5 files changed, 23 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 156c81065..6a6040865 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -202,9 +202,7 @@ sub report_form_ajax : Path('ajax') : Args(0) { my @list_of_names = map { $_->name } values %{$c->stash->{bodies}}; my %display_names = map { - my $name = $_->get_cobrand_handler && $_->get_cobrand_handler->can('council_name') - ? $_->get_cobrand_handler->council_name - : $_->name; + my $name = $_->cobrand_name; ( $_->name ne $name ) ? ( $_->name => $name ) : (); } values %{$c->stash->{bodies}}; my $contribute_as = {}; diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index fc5176a07..9b33b42b4 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -287,12 +287,12 @@ sub rss_ward : Path('/rss/reports') : Args(2) { if ($c->stash->{ward}) { # Problems sent to a council, restricted to a ward $c->stash->{type} = 'ward_problems'; - $c->stash->{title_params} = { COUNCIL => $c->stash->{body}->name, WARD => $c->stash->{ward}{name} }; + $c->stash->{title_params} = { COUNCIL => $c->stash->{body}->cobrand_name, WARD => $c->stash->{ward}{name} }; $c->stash->{db_params} = [ $c->stash->{body}->id, $c->stash->{ward}->{id} ]; } else { # Problems sent to a council $c->stash->{type} = 'council_problems'; - $c->stash->{title_params} = { COUNCIL => $c->stash->{body}->name }; + $c->stash->{title_params} = { COUNCIL => $c->stash->{body}->cobrand_name }; $c->stash->{db_params} = [ $c->stash->{body}->id ]; } diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm index 9424eaf03..7251bc863 100644 --- a/perllib/FixMyStreet/DB/Result/Body.pm +++ b/perllib/FixMyStreet/DB/Result/Body.pm @@ -215,6 +215,22 @@ sub get_cobrand_handler { return FixMyStreet::Cobrand->body_handler($self->areas); } +=item + +If get_cobrand_handler returns a cobrand, and that cobrand +has a council_name, use it in preference to the body name. + +=cut + +sub cobrand_name { + my $self = shift; + my $handler = $self->get_cobrand_handler; + if ($handler && $handler->can('council_name')) { + return $handler->council_name; + } + return $self->name; +} + sub calculate_average { my ($self, $threshold) = @_; $threshold ||= 0; diff --git a/templates/web/base/report/new/form_user_loggedin.html b/templates/web/base/report/new/form_user_loggedin.html index 1016c5c47..95fc9d751 100644 --- a/templates/web/base/report/new/form_user_loggedin.html +++ b/templates/web/base/report/new/form_user_loggedin.html @@ -25,7 +25,7 @@ <option value="another_user">[% loc('Another user') %]</option> [% END %] [% IF js || can_contribute_as_body %] - <option value="body" [% c.user.from_body AND ( c.user.has_body_permission_to('planned_reports') || c.user.has_body_permission_to('default_to_body') ) ? 'selected' : '' %]>[% c.user.from_body.get_cobrand_handler ? c.user.from_body.get_cobrand_handler.council_name : c.user.from_body.name %]</option> + <option value="body" [% c.user.from_body AND ( c.user.has_body_permission_to('planned_reports') || c.user.has_body_permission_to('default_to_body') ) ? 'selected' : '' %]>[% c.user.from_body.cobrand_name %]</option> [% END %] </select> [% END %] diff --git a/templates/web/base/reports/_rss.html b/templates/web/base/reports/_rss.html index fdb833315..567be92ea 100644 --- a/templates/web/base/reports/_rss.html +++ b/templates/web/base/reports/_rss.html @@ -1,8 +1,9 @@ <div class="shadow-wrap"> <ul id="key-tools"> <li><a rel="nofollow" id="key-tool-updates-area" class="feed" href="[% rss_url %]">[% - IF c.cobrand.moniker == 'bromley' AND thing == 'council'; - 'Get updates of reports in Bromley'; + SET monikers = ['bromley','hounslow']; + IF monikers.grep(c.cobrand.moniker).size AND thing == 'council'; + 'Get updates of reports in ' _ c.cobrand.moniker.ucfirst; ELSIF c.cobrand.moniker == 'bromley'; 'Get updates of reports in this ward'; ELSIF c.cobrand.is_council; |