diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/LichfieldDC.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 7 | ||||
-rw-r--r-- | templates/web/default/tokens/confirm_problem.html | 4 |
4 files changed, 28 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 5eee5f731..2943c9ac4 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -98,6 +98,18 @@ Return the base url for the cobranded version of the site sub base_url { mySociety::Config::get('BASE_URL') } +=head2 url_for_report + +Return the url for a report (might be different in a two-tier county, but +most of the time will be same as base_url). + +=cut + +sub url_for_report { + my ( $self, $problem ) = @_; + return $self->base_url . $problem->url; +} + =head2 base_host Return the base host for the cobranded version of the site diff --git a/perllib/FixMyStreet/Cobrand/LichfieldDC.pm b/perllib/FixMyStreet/Cobrand/LichfieldDC.pm index d0b000102..f98775c91 100644 --- a/perllib/FixMyStreet/Cobrand/LichfieldDC.pm +++ b/perllib/FixMyStreet/Cobrand/LichfieldDC.pm @@ -26,5 +26,16 @@ sub disambiguate_location { }; } +# If we ever link to a county problem report, needs to be to main FixMyStreet +sub url_for_report { + my ( $self, $problem ) = @_; + my %councils = map { $_ => 1 } @{$problem->councils}; + if ( $councils{2434} ) { + return $self->base_url . $problem->url; + } else { + return FixMyStreet->config('BASE_URL') . $problem->url; + } +} + 1; diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 9cbaef6c2..4af6f80cd 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -551,9 +551,8 @@ sub body { if ($problem->external_body) { $body = $problem->external_body; } else { - (my $council = $problem->council) =~ s/\|.*//g; - my @councils = split( /,/, $council ); - my $areas_info = mySociety::MaPit::call('areas', \@councils); + my $councils = $problem->councils; + my $areas_info = mySociety::MaPit::call('areas', $councils); $body = join( _(' and '), map { my $name = $areas_info->{$_}->{name}; @@ -564,7 +563,7 @@ sub body { } else { $name; } - } @councils + } @$councils ); } return $body; diff --git a/templates/web/default/tokens/confirm_problem.html b/templates/web/default/tokens/confirm_problem.html index 1e3c6c535..2437c1cd9 100644 --- a/templates/web/default/tokens/confirm_problem.html +++ b/templates/web/default/tokens/confirm_problem.html @@ -6,7 +6,7 @@ [% IF c.cobrand.is_council %] Thank you. You have successfully confirmed your report and this will now be investigated by the council. -You can <a href="[% c.uri_for( '/report', problem.id ) %]">view the problem on this site</a>. +You can <a href="[% c.cobrand.url_for_report( problem ) %]">view the problem on this site</a>. </p> <p>Your reference for this problem is [% problem.id %], please quote it in any enquiries. @@ -20,7 +20,7 @@ You can <a href="[% c.uri_for( '/report', problem.id ) %]">view the problem on t tprintf( loc( '. You can <a href="%s">view the problem on this site</a>.' ), - c.uri_for( '/report', problem.id ) + c.cobrand.url_for_report( problem ) ); %] [% END %] |