diff options
author | Struan Donald <struan@exo.org.uk> | 2014-03-26 18:01:55 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2014-04-08 13:21:14 +0100 |
commit | ac7443809e921594c2a5682c49ddf388cdb2598f (patch) | |
tree | 5f2ef634eb046edf09d64252350ad3a305e96ef5 | |
parent | 796c4715cf4e0cdfab8e7acadfac5b8e55b884b8 (diff) |
Use flags to indicate type of location error
This makes it a bit easier to override the message in templates which
makes it a bit easier for cobrands.
Leaves the default error message in location_error stash key which
should prevent any existing logic breaking.
6 files changed, 8 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index 5d95c2538..ceec04027 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -69,6 +69,7 @@ sub load_and_check_areas : Private { type => $area_types ); } if ($all_areas->{error}) { + $c->stash->{location_error_mapit_error} = 1; $c->stash->{location_error} = $all_areas->{error}; return; } @@ -78,6 +79,7 @@ sub load_and_check_areas : Private { $c->cobrand->area_check( { all_areas => $all_areas }, $c->stash->{area_check_action} ); if ( !$success ) { + $c->stash->{location_error_cobrand_check} = 1; $c->stash->{location_error} = $error_msg; return; } @@ -87,6 +89,7 @@ sub load_and_check_areas : Private { # If we don't have any areas we can't accept the report if ( !scalar keys %$all_areas ) { + $c->stash->{location_error_no_areas} = 1; $c->stash->{location_error} = _('That location does not appear to be covered by a council; perhaps it is offshore or outside the country. Please try again.'); return; } diff --git a/perllib/FixMyStreet/App/Controller/Location.pm b/perllib/FixMyStreet/App/Controller/Location.pm index f103ff7f9..4312b6911 100644 --- a/perllib/FixMyStreet/App/Controller/Location.pm +++ b/perllib/FixMyStreet/App/Controller/Location.pm @@ -103,6 +103,7 @@ sub determine_location_from_pc : Private { } # pass errors back to the template + $c->stash->{location_error_pc_lookup} = 1; $c->stash->{location_error} = $error; return; } diff --git a/templates/web/default/around/around_index.html b/templates/web/default/around/around_index.html index a143e90a2..087abf65f 100644 --- a/templates/web/default/around/around_index.html +++ b/templates/web/default/around/around_index.html @@ -6,7 +6,7 @@ [% INCLUDE 'around/postcode_form.html' %] [% IF location_error %] - <p class="error">[% location_error %]</p> + [% INCLUDE 'around/location_error.html' %] [% END %] [% IF possible_location_matches %] diff --git a/templates/web/default/around/location_error.html b/templates/web/default/around/location_error.html new file mode 100644 index 000000000..9b907b64b --- /dev/null +++ b/templates/web/default/around/location_error.html @@ -0,0 +1 @@ +<p class="error">[% location_error %]</p> diff --git a/templates/web/fixmystreet/around/around_index.html b/templates/web/fixmystreet/around/around_index.html index c547b7ba9..0d9d35171 100644 --- a/templates/web/fixmystreet/around/around_index.html +++ b/templates/web/fixmystreet/around/around_index.html @@ -9,7 +9,7 @@ %] [% IF location_error %] - <p class="form-error">[% location_error %]</p> + [% INCLUDE 'around/location_error.html' %] [% END %] [% IF possible_location_matches %] diff --git a/templates/web/fixmystreet/around/location_error.html b/templates/web/fixmystreet/around/location_error.html new file mode 100644 index 000000000..fc9b2b8ce --- /dev/null +++ b/templates/web/fixmystreet/around/location_error.html @@ -0,0 +1 @@ +<p class="form-error">[% location_error %]</p> |