diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-01-22 15:57:45 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2015-02-13 11:44:07 +0000 |
commit | da63f72c27e16d491f9103b9a8cbdb2fd96d2b59 (patch) | |
tree | cfd6df35b4c41028943d8a1e669345b81be41913 | |
parent | 04117b8be30b5d82d50cdc047ac4e7c19864f8ed (diff) |
Make sure all co-ordinates are stringified.
This includes MapIt postcode lookups, geocoding, query parameters, tile
clicks. Stringifying truncates them to six decimal places, which means
we no longer need any "short" versions anywhere, and the JSON response
will always uses a decimal point regardless of locale.
22 files changed, 160 insertions, 124 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm index e821b7467..1aa70b497 100644 --- a/perllib/FixMyStreet/App/Controller/Alert.pm +++ b/perllib/FixMyStreet/App/Controller/Alert.pm @@ -441,11 +441,6 @@ sub determine_location : Private { $c->go('index'); } - # truncate the lat,lon for nicer urls - ( $c->stash->{latitude}, $c->stash->{longitude} ) = - map { Utils::truncate_coordinate($_) } - ( $c->stash->{latitude}, $c->stash->{longitude} ); - my $dist = mySociety::Gaze::get_radius_containing_population( $c->stash->{latitude}, $c->stash->{longitude}, 200000 ); diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 0e42b8a17..413af814f 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -40,8 +40,10 @@ sub around_index : Path : Args(0) { # Try to create a location for whatever we have my $ret = $c->forward('/location/determine_location_from_coords') || $c->forward('/location/determine_location_from_pc'); - return unless $ret; - return $c->res->redirect('/') if $ret == -1 && !$partial_report; + unless ($ret) { + return $c->res->redirect('/') unless $c->req->param('pc') || $partial_report; + return; + } # Check to see if the spot is covered by a area - if not show an error. return unless $c->cobrand->moniker eq 'fixmybarangay' || $c->forward('check_location_is_acceptable'); @@ -158,12 +160,6 @@ sub display_location : Private { my $latitude = $c->stash->{latitude}; my $longitude = $c->stash->{longitude}; - # truncate the lat,lon for nicer rss urls, and strings for outputting - my $short_latitude = Utils::truncate_coordinate($latitude); - my $short_longitude = Utils::truncate_coordinate($longitude); - $c->stash->{short_latitude} = $short_latitude; - $c->stash->{short_longitude} = $short_longitude; - # Deal with pin hiding/age my $all_pins = $c->req->param('all_pins') ? 1 : undef; $c->stash->{all_pins} = $all_pins; @@ -171,7 +167,7 @@ sub display_location : Private { # get the map features my ( $on_map_all, $on_map, $around_map, $distance ) = - FixMyStreet::Map::map_features( $c, $short_latitude, $short_longitude, + FixMyStreet::Map::map_features( $c, $latitude, $longitude, $interval ); # copy the found reports to the stash @@ -199,8 +195,8 @@ sub display_location : Private { $c->stash->{page} = 'around'; # So the map knows to make clickable pins, update on pan FixMyStreet::Map::display_map( $c, - latitude => $short_latitude, - longitude => $short_longitude, + latitude => $latitude, + longitude => $longitude, clickable => 1, pins => \@pins, area => $c->cobrand->areas_on_around, @@ -317,7 +313,7 @@ sub _geocode : Private { if ( ref($suggestions) eq 'ARRAY' ) { foreach (@$suggestions) { push @addresses, decode_utf8($_->{address}); - push @locations, { address => decode_utf8($_->{address}), lat => $_->{latitude}, long => $_->{longitude} }; + push @locations, { address => decode_utf8($_->{address}), lat => $_->{latitude}, long => $_->{longitude} }; } $response = { suggestions => \@addresses, locations => \@locations }; } else { diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index 8a174c254..a5915aa46 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -49,9 +49,6 @@ sub load_and_check_areas : Private { $area_types = $c->cobrand->area_types; } - my $short_latitude = Utils::truncate_coordinate($latitude); - my $short_longitude = Utils::truncate_coordinate($longitude); - my $all_areas; my %params; @@ -62,7 +59,7 @@ sub load_and_check_areas : Private { my %area_types = map { $_ => 1 } @$area_types; $all_areas = mySociety::MaPit::call( 'point', - "4326/$short_longitude,$short_latitude", %params ); + "4326/$longitude,$latitude", %params ); $c->stash->{all_areas_mapit} = $all_areas; $all_areas = { map { $_ => $all_areas->{$_} } @@ -72,7 +69,7 @@ sub load_and_check_areas : Private { } else { $all_areas = mySociety::MaPit::call( 'point', - "4326/$short_longitude,$short_latitude", %params, + "4326/$longitude,$latitude", %params, type => $area_types ); } if ($all_areas->{error}) { diff --git a/perllib/FixMyStreet/App/Controller/Location.pm b/perllib/FixMyStreet/App/Controller/Location.pm index 8a68b2b3d..5e5349a6c 100644 --- a/perllib/FixMyStreet/App/Controller/Location.pm +++ b/perllib/FixMyStreet/App/Controller/Location.pm @@ -6,6 +6,7 @@ BEGIN {extends 'Catalyst::Controller'; } use Encode; use FixMyStreet::Geocode; +use Utils; =head1 NAME @@ -32,8 +33,8 @@ sub determine_location_from_coords : Private { my $longitude = $c->req->param('longitude') || $c->req->param('lon'); if ( defined $latitude && defined $longitude ) { - $c->stash->{latitude} = $latitude; - $c->stash->{longitude} = $longitude; + ($c->stash->{latitude}, $c->stash->{longitude}) = + map { Utils::truncate_coordinate($_) } ($latitude, $longitude); # Also save the pc if there is one if ( my $pc = $c->req->param('pc') ) { @@ -50,7 +51,7 @@ sub determine_location_from_coords : Private { User has searched for a location - try to find it for them. -Return -1 if nothing provided. +Return false if nothing provided. If one match is found returns true and lat/lng is set. @@ -64,18 +65,19 @@ sub determine_location_from_pc : Private { my ( $self, $c, $pc ) = @_; # check for something to search - $pc ||= $c->req->param('pc') || return -1; + $pc ||= $c->req->param('pc') || return; $c->stash->{pc} = $pc; # for template if ( $pc =~ /^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/ ) { - $c->stash->{latitude} = $1; - $c->stash->{longitude} = $2; + ($c->stash->{latitude}, $c->stash->{longitude}) = + map { Utils::truncate_coordinate($_) } ($1, $2); return $c->forward( 'check_location' ); } if ( $c->cobrand->country eq 'GB' && $pc =~ /^([A-Z])([A-Z])([\d\s]{4,})$/i) { if (my $convert = gridref_to_latlon( $1, $2, $3 )) { - $c->stash->{latitude} = $convert->{latitude}; - $c->stash->{longitude} = $convert->{longitude}; + ($c->stash->{latitude}, $c->stash->{longitude}) = + map { Utils::truncate_coordinate($_) } + ($convert->{latitude}, $convert->{longitude}); return $c->forward( 'check_location' ); } } diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 46d6350d7..70edcabe3 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -279,10 +279,6 @@ sub display : Private { my $problem = $c->stash->{questionnaire}->problem; - ( $c->stash->{short_latitude}, $c->stash->{short_longitude} ) = - map { Utils::truncate_coordinate($_) } - ( $problem->latitude, $problem->longitude ); - $c->stash->{updates} = [ $c->model('DB::Comment')->search( { problem_id => $problem->id, state => 'confirmed' }, { order_by => 'confirmed' } diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 88a49f6c9..e188a085d 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -159,7 +159,7 @@ sub format_problem_for_display : Private { my $problem = $c->stash->{problem}; - ( $c->stash->{short_latitude}, $c->stash->{short_longitude} ) = + ( $c->stash->{latitude}, $c->stash->{longitude} ) = map { Utils::truncate_coordinate($_) } ( $problem->latitude, $problem->longitude ); diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index ed5be4e99..ebc5cc6a0 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -540,8 +540,8 @@ sub determine_location_from_tile_click : Private { ); # store it on the stash - $c->stash->{latitude} = $latitude; - $c->stash->{longitude} = $longitude; + ($c->stash->{latitude}, $c->stash->{longitude}) = + map { Utils::truncate_coordinate($_) } ($latitude, $longitude); # set a flag so that the form is not considered submitted. This will prevent # errors showing on the fields. @@ -1090,10 +1090,6 @@ sub generate_map : Private { my $latitude = $c->stash->{latitude}; my $longitude = $c->stash->{longitude}; - ( $c->stash->{short_latitude}, $c->stash->{short_longitude} ) = - map { Utils::truncate_coordinate($_) } - ( $c->stash->{latitude}, $c->stash->{longitude} ); - # Don't do anything if the user skipped the map if ( $c->stash->{report}->used_map ) { $c->stash->{page} = 'new'; diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index b5be152a8..bf1681b70 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -12,6 +12,7 @@ use FixMyStreet::Geocode::Bing; use FixMyStreet::Geocode::Google; use FixMyStreet::Geocode::OSM; use FixMyStreet::Geocode::Zurich; +use Utils; # lookup STRING CONTEXT # Given a user-inputted string, try and convert it into co-ordinates using either @@ -21,6 +22,11 @@ use FixMyStreet::Geocode::Zurich; sub lookup { my ($s, $c) = @_; my $data = $c->cobrand->geocode_postcode($s); + if (defined $data->{latitude}) { + ( $data->{latitude}, $data->{longitude} ) = + map { Utils::truncate_coordinate($_) } + ( $data->{latitude}, $data->{longitude} ); + } $data = string($s, $c) unless $data->{error} || defined $data->{latitude}; $data->{error} = _('Sorry, we could not find that location.') diff --git a/perllib/FixMyStreet/Geocode/Bing.pm b/perllib/FixMyStreet/Geocode/Bing.pm index 702e19814..61e04d3d5 100644 --- a/perllib/FixMyStreet/Geocode/Bing.pm +++ b/perllib/FixMyStreet/Geocode/Bing.pm @@ -13,7 +13,7 @@ use File::Path (); use LWP::Simple; use Digest::MD5 qw(md5_hex); -use mySociety::Locale; +use Utils; # string STRING CONTEXT # Looks up on Bing Maps API, and caches, a user-inputted location. @@ -71,15 +71,14 @@ sub string { || $valid_locations[-1]{address}{locality} eq $_->{address}{locality} ); - ( $latitude, $longitude ) = @{ $_->{point}->{coordinates} }; - # These co-ordinates are output as query parameters in a URL, make sure they have a "." - mySociety::Locale::in_gb_locale { - push (@$error, { - address => $address, - latitude => sprintf('%0.6f', $latitude), - longitude => sprintf('%0.6f', $longitude) - }); - }; + ( $latitude, $longitude ) = + map { Utils::truncate_coordinate($_) } + @{ $_->{point}->{coordinates} }; + push (@$error, { + address => $address, + latitude => $latitude, + longitude => $longitude + }); push (@valid_locations, $_); } diff --git a/perllib/FixMyStreet/Geocode/FixaMinGata.pm b/perllib/FixMyStreet/Geocode/FixaMinGata.pm index 2ea92c422..5c6851011 100644 --- a/perllib/FixMyStreet/Geocode/FixaMinGata.pm +++ b/perllib/FixMyStreet/Geocode/FixaMinGata.pm @@ -14,7 +14,6 @@ package FixMyStreet::Geocode::FixaMinGata; use warnings; use strict; -use Data::Dumper; use Digest::MD5 qw(md5_hex); use Encode; @@ -23,7 +22,7 @@ use File::Path (); use LWP::Simple qw($ua); use Memcached; use XML::Simple; -use mySociety::Locale; +use Utils; my $osmapibase = "http://www.openstreetmap.org/api/"; my $nominatimbase = "http://nominatim.openstreetmap.org/"; @@ -45,8 +44,8 @@ sub string { my %query_params = ( q => $s, format => 'json', - addressdetails => 1, - limit => 20, + addressdetails => 1, + limit => 20, #'accept-language' => '', email => 'info' . chr(64) . 'morus.se', ); @@ -77,32 +76,25 @@ sub string { my ( %locations, $error, @valid_locations, $latitude, $longitude ); foreach (@$js) { - # These co-ordinates are output as query parameters in a URL, make sure they have a "." - next if $_->{class} eq "boundary"; - - my @s = split(/,/, $_->{display_name}); - - my $address = join(",", @s[0,1,2]); - + next if $_->{class} eq "boundary"; + my @s = split(/,/, $_->{display_name}); + my $address = join(",", @s[0,1,2]); $locations{$address} = [$_->{lat}, $_->{lon}]; } - my ($key) = keys %locations; - - return { latitude => $locations{$key}[0], longitude => $locations{$key}[1] } if scalar keys %locations == 1; - return { error => _('Sorry, we could not find that location.') } if scalar keys %locations == 0; - - foreach $key (keys %locations) { - ( $latitude, $longitude ) = ($locations{$key}[0], $locations{$key}[1]); - mySociety::Locale::in_gb_locale { - push (@$error, { - address => $key, - latitude => sprintf('%0.6f', $latitude), - longitude => sprintf('%0.6f', $longitude) - }); - }; + foreach my $key (keys %locations) { + ( $latitude, $longitude ) = + map { Utils::truncate_coordinate($_) } + ($locations{$key}[0], $locations{$key}[1]); + push (@$error, { + address => $key, + latitude => $latitude, + longitude => $longitude + }); + push (@valid_locations, $_); } + return { latitude => $latitude, longitude => $longitude } if scalar @valid_locations == 1; return { error => $error }; } diff --git a/perllib/FixMyStreet/Geocode/Google.pm b/perllib/FixMyStreet/Geocode/Google.pm index 11ff8ef80..d83920a81 100644 --- a/perllib/FixMyStreet/Geocode/Google.pm +++ b/perllib/FixMyStreet/Geocode/Google.pm @@ -12,7 +12,7 @@ use File::Slurp; use File::Path (); use LWP::Simple; use Digest::MD5 qw(md5_hex); -use mySociety::Locale; +use Utils; # string STRING CONTEXT # Looks up on Google Maps API, and caches, a user-inputted location. @@ -78,15 +78,14 @@ sub string { next unless $_->{AddressDetails}->{Accuracy} >= 4; my $address = $_->{address}; next unless $c->cobrand->geocoded_string_check( $address ); - ( $longitude, $latitude ) = @{ $_->{Point}->{coordinates} }; - # These co-ordinates are output as query parameters in a URL, make sure they have a "." - mySociety::Locale::in_gb_locale { - push (@$error, { - address => $address, - latitude => sprintf('%0.6f', $latitude), - longitude => sprintf('%0.6f', $longitude) - }); - }; + ( $longitude, $latitude ) = + map { Utils::truncate_coordinate($_) } + @{ $_->{Point}->{coordinates} }; + push (@$error, { + address => $address, + latitude => $latitude, + longitude => $longitude + }); push (@valid_locations, $_); } return { latitude => $latitude, longitude => $longitude } if scalar @valid_locations == 1; diff --git a/perllib/FixMyStreet/Geocode/OSM.pm b/perllib/FixMyStreet/Geocode/OSM.pm index 919940f78..082d8fbc1 100644 --- a/perllib/FixMyStreet/Geocode/OSM.pm +++ b/perllib/FixMyStreet/Geocode/OSM.pm @@ -16,7 +16,7 @@ use File::Path (); use LWP::Simple qw($ua); use Memcached; use XML::Simple; -use mySociety::Locale; +use Utils; my $osmapibase = "http://www.openstreetmap.org/api/"; my $nominatimbase = "http://nominatim.openstreetmap.org/"; @@ -68,15 +68,14 @@ sub string { my ( $error, @valid_locations, $latitude, $longitude ); foreach (@$js) { - # These co-ordinates are output as query parameters in a URL, make sure they have a "." - ( $latitude, $longitude ) = ( $_->{lat}, $_->{lon} ); - mySociety::Locale::in_gb_locale { - push (@$error, { - address => $_->{display_name}, - latitude => sprintf('%0.6f', $latitude), - longitude => sprintf('%0.6f', $longitude) - }); - }; + ( $latitude, $longitude ) = + map { Utils::truncate_coordinate($_) } + ( $_->{lat}, $_->{lon} ); + push (@$error, { + address => $_->{display_name}, + latitude => $latitude, + longitude => $longitude + }); push (@valid_locations, $_); } diff --git a/perllib/FixMyStreet/Geocode/Zurich.pm b/perllib/FixMyStreet/Geocode/Zurich.pm index 1f0b4fc16..7de2cc272 100644 --- a/perllib/FixMyStreet/Geocode/Zurich.pm +++ b/perllib/FixMyStreet/Geocode/Zurich.pm @@ -15,7 +15,7 @@ use Digest::MD5 qw(md5_hex); use File::Path (); use Geo::Coordinates::CH1903; use Storable; -use mySociety::Locale; +use Utils; my ($soap, $method, $security); @@ -92,14 +92,14 @@ sub string { my ( $error, @valid_locations, $latitude, $longitude ); foreach (@$results) { - ($latitude, $longitude) = Geo::Coordinates::CH1903::to_latlon($_->{easting}, $_->{northing}); - mySociety::Locale::in_gb_locale { - push (@$error, { - address => $_->{text}, - latitude => sprintf('%0.6f', $latitude), - longitude => sprintf('%0.6f', $longitude) - }); - }; + ($latitude, $longitude) = + map { Utils::truncate_coordinate($_) } + Geo::Coordinates::CH1903::to_latlon($_->{easting}, $_->{northing}); + push (@$error, { + address => $_->{text}, + latitude => $latitude, + longitude => $longitude + }); push (@valid_locations, $_); last if lc($_->{text}) eq lc($s); } diff --git a/t/MapIt.pm b/t/MapIt.pm new file mode 100644 index 000000000..ebef934e1 --- /dev/null +++ b/t/MapIt.pm @@ -0,0 +1,36 @@ +package t::MapIt; + +use JSON; +use Web::Simple; + +use mySociety::Locale; + +has json => ( + is => 'lazy', + default => sub { + JSON->new->pretty->allow_blessed->convert_blessed; + }, +); + +sub dispatch_request { + my $self = shift; + + sub (GET + /postcode/*) { + my ($self, $postcode) = @_; + my $response = $self->postcode($postcode); + # We must make sure we output correctly for testing purposes, we might + # be within a different locale here... + my $json = mySociety::Locale::in_gb_locale { + $self->json->encode($response) }; + return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ]; + }, +} + +sub postcode { + my ($self, $postcode) = @_; + return { + wgs84_lat => 51.5, wgs84_lon => 2.1, postcode => $postcode, + }; +} + +__PACKAGE__->run_if_script; diff --git a/t/cobrand/fixamingata.t b/t/cobrand/fixamingata.t index 105847576..714d475e1 100644 --- a/t/cobrand/fixamingata.t +++ b/t/cobrand/fixamingata.t @@ -1,12 +1,16 @@ use strict; use warnings; use Test::More; +use LWP::Protocol::PSGI; BEGIN { use FixMyStreet; FixMyStreet->test_mode(1); } +use t::MapIt; +use mySociety::Locale; + use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; @@ -96,6 +100,25 @@ like $email->header('Content-Type'), qr/iso-8859-1/, 'encoding looks okay'; like $email->body, qr/V=E4nligen,/, 'signature looks correct'; $mech->clear_emails_ok; +subtest "Test ajax decimal points" => sub { + # The following line is so we are definitely not in Swedish before + # requesting the page, so that the code performs a full switch to Swedish + mySociety::Locale::push('en-gb'); + + # A note to the future - the run_if_script line must be within a subtest + # otherwise it fails to work + LWP::Protocol::PSGI->register(t::MapIt->run_if_script, host => 'mapit.sweden'); + + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ 'fixamingata' ], + MAPIT_URL => 'http://mapit.sweden/' + }, sub { + $mech->get_ok('/ajax/lookup_location?term=12345'); + # We want an actual decimal point in a JSON response... + $mech->content_contains('51.5'); + }; +}; + END { $mech->delete_problems_for_body(1); ok $mech->host("www.fixmystreet.com"), "change host back"; diff --git a/templates/web/base/around/display_location.html b/templates/web/base/around/display_location.html index 804be9603..3f4ec8881 100755 --- a/templates/web/base/around/display_location.html +++ b/templates/web/base/around/display_location.html @@ -6,14 +6,14 @@ rss_url = pc ? c.uri_for( "/rss/pc", pc ) - : c.uri_for( "/rss/l/$short_latitude,$short_longitude" ); + : c.uri_for( "/rss/l/$latitude,$longitude" ); email_url = c.uri_for( '/alert/list', { - lat => short_latitude, - lon => short_longitude, - feed => "local:$short_latitude:$short_longitude", + lat => latitude, + lon => longitude, + feed => "local:$latitude:$longitude", } ); @@ -21,8 +21,8 @@ '/report/new', { pc => pc - latitude => short_latitude, - longitude => short_longitude, + latitude => latitude, + longitude => longitude, skipped => 1, } ); @@ -45,8 +45,8 @@ [% END %] <input type="hidden" name="pc" value="[% pc | html %]"> - <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% short_latitude | html %]"> - <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% short_longitude | html %]"> + <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% latitude | html %]"> + <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% longitude | html %]"> [% END %] [% map_html %] diff --git a/templates/web/base/report/display.html b/templates/web/base/report/display.html index a7181942f..0731d9f0e 100644 --- a/templates/web/base/report/display.html +++ b/templates/web/base/report/display.html @@ -31,7 +31,7 @@ [% IF c.cobrand.moniker != 'emptyhomes' %] <p style="padding-bottom: 0.5em; border-bottom: dotted 1px #999999;" align="right"> - <a href="[% c.uri_for( '/around', { lat => short_latitude, lon => short_longitude } ) %]">[% loc( 'More problems nearby' ) %]</a> + <a href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]">[% loc( 'More problems nearby' ) %]</a> </p> <div id="alert_links"> diff --git a/templates/web/base/report/new/fill_in_details.html b/templates/web/base/report/new/fill_in_details.html index 1b8a866fc..9d3f52041 100644 --- a/templates/web/base/report/new/fill_in_details.html +++ b/templates/web/base/report/new/fill_in_details.html @@ -22,8 +22,8 @@ [% END %] - <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% short_latitude | html %]"> - <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% short_longitude | html %]"> + <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% latitude | html %]"> + <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% longitude | html %]"> [% IF report.used_map %] [% map_html %] diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html index f30b4b86d..75b7700a5 100644 --- a/templates/web/bromley/report/display.html +++ b/templates/web/bromley/report/display.html @@ -25,7 +25,7 @@ <ul id="key-tools"> <li><a rel="nofollow" id="key-tool-report-abuse" class="abuse" href="[% c.uri_for( '/contact', { id => problem.id } ) %]">[% loc('Report abuse') %]</a></li> <li><a rel="nofollow" id="key-tool-report-updates" class="feed" href="[% c.uri_for( '/alert/subscribe', { id => problem.id } ) %]">[% loc('Get updates' ) %]</a></li> - <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => short_latitude, lon => short_longitude } ) %]">[% loc( 'Problems nearby' ) %]</a></li> + <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]">[% loc( 'Problems nearby' ) %]</a></li> </ul> <div id="report-updates-data" class="hidden-js"> diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html index 4f4e7a2a6..91762e022 100644 --- a/templates/web/fixmystreet/report/display.html +++ b/templates/web/fixmystreet/report/display.html @@ -38,9 +38,9 @@ <li><a rel="nofollow" id="key-tool-report-share" class="share" href="#report-share">[% loc('Share') %]</a></li> [% END %] [% IF c.cobrand.moniker == 'zurich' %] - <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => short_latitude, lon => short_longitude } ) %]">[% loc( 'Problems on the map' ) %]</a></li> + <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]">[% loc( 'Problems on the map' ) %]</a></li> [% ELSE %] - <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => short_latitude, lon => short_longitude } ) %]">[% loc( 'Problems nearby' ) %]</a></li> + <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]">[% loc( 'Problems nearby' ) %]</a></li> [% END %] </ul> diff --git a/templates/web/seesomething/around/display_location.html b/templates/web/seesomething/around/display_location.html index ea0a499f7..b54311264 100644 --- a/templates/web/seesomething/around/display_location.html +++ b/templates/web/seesomething/around/display_location.html @@ -4,8 +4,8 @@ '/report/new', { pc => pc - latitude => short_latitude, - longitude => short_longitude, + latitude => latitude, + longitude => longitude, skipped => 1, } ); @@ -25,8 +25,8 @@ [% END %] <input type="hidden" name="pc" value="[% pc | html %]"> - <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% short_latitude | html %]"> - <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% short_longitude | html %]"> + <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% latitude | html %]"> + <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% longitude | html %]"> [% map_html %] diff --git a/templates/web/zerotb/report/display.html b/templates/web/zerotb/report/display.html index 9161fb586..697b5428c 100644 --- a/templates/web/zerotb/report/display.html +++ b/templates/web/zerotb/report/display.html @@ -25,7 +25,7 @@ <div class="shadow-wrap"> <ul id="key-tools"> - <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => short_latitude, lon => short_longitude } ) %]">[% loc( 'Clinics nearby' ) %]</a></li> + <li><a class="chevron" id="key-tool-problems-nearby" href="[% c.uri_for( '/around', { lat => latitude, lon => longitude } ) %]">[% loc( 'Clinics nearby' ) %]</a></li> </ul> </div> |