diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-05-24 13:05:51 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-05-24 13:05:51 +0100 |
commit | 388a9b16d9dfa25b4854c8a3685dc3c764c391a5 (patch) | |
tree | adf06aab9a14f688437d1fddc3549a9e65fa64db | |
parent | 2c8512b36c8a3c48d15e7243ca40e3947c2fc162 (diff) |
Move lat/lon to templates and use shortened forms.
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Bing.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/BingOL.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Google.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/OSM.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/OSM/StreetView.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Tilma/Original.pm | 2 | ||||
-rw-r--r-- | t/app/controller/around.t | 12 | ||||
-rwxr-xr-x | templates/web/default/around/display_location.html | 3 | ||||
-rw-r--r-- | templates/web/default/report/new/fill_in_details.html | 5 |
13 files changed, 20 insertions, 24 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 986543e9d..c5258e7d0 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -198,6 +198,10 @@ 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 ); + my $problem_text = ''; # Page::display_problem_text($c->fake_q, $problem); # FIXME This needs to be in the template $c->stash->{updates} = ''; # FIXME Should be database ResultSet of problem's pdates $c->stash->{map_start_html} = FixMyStreet::Map::display_map( diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 6e959c830..180d2198d 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -894,6 +894,10 @@ 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} ); + # Forms that allow photos need a different enctype my $allow_photo_upload = $c->cobrand->allow_photo_upload; diff --git a/perllib/FixMyStreet/Map/Bing.pm b/perllib/FixMyStreet/Map/Bing.pm index 8378cd871..4b15b4a76 100644 --- a/perllib/FixMyStreet/Map/Bing.pm +++ b/perllib/FixMyStreet/Map/Bing.pm @@ -40,8 +40,6 @@ sub display_map { my $copyright = _('Map contains Ordnance Survey data © Crown copyright and database right 2010.'); my $key = mySociety::Config::get('BING_MAPS_API_KEY'); $out .= <<EOF; -<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}"> <script type="text/javascript"> var fixmystreet = { 'key': '$key', diff --git a/perllib/FixMyStreet/Map/BingOL.pm b/perllib/FixMyStreet/Map/BingOL.pm index ca6057a26..39ac2781a 100644 --- a/perllib/FixMyStreet/Map/BingOL.pm +++ b/perllib/FixMyStreet/Map/BingOL.pm @@ -41,8 +41,6 @@ sub display_map { my $out = ''; my $copyright = _('Map contains Ordnance Survey data © Crown copyright and database right 2010. Microsoft'); $out .= <<EOF; -<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}"> <script type="text/javascript"> var fixmystreet = { 'latitude': $params{latitude}, diff --git a/perllib/FixMyStreet/Map/Google.pm b/perllib/FixMyStreet/Map/Google.pm index b7753223b..d74f5eb2d 100644 --- a/perllib/FixMyStreet/Map/Google.pm +++ b/perllib/FixMyStreet/Map/Google.pm @@ -39,8 +39,6 @@ sub display_map { my $out = ''; my $copyright = _('Map contains Ordnance Survey data © Crown copyright and database right 2010.'); $out .= <<EOF; -<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}"> <script type="text/javascript"> var fixmystreet = { 'latitude': $params{latitude}, diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm index 9608f9f01..292ad4ed7 100644 --- a/perllib/FixMyStreet/Map/OSM.pm +++ b/perllib/FixMyStreet/Map/OSM.pm @@ -76,8 +76,6 @@ sub display_map { my $compass = compass($q, $x_tile, $y_tile, $zoom); my $map_type = $self->map_type(); $out .= <<EOF; -<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}"> <input type="hidden" name="zoom" value="$zoom"> <script type="text/javascript"> var fixmystreet = { diff --git a/perllib/FixMyStreet/Map/OSM/StreetView.pm b/perllib/FixMyStreet/Map/OSM/StreetView.pm index 2024a83fc..9849c1ed5 100644 --- a/perllib/FixMyStreet/Map/OSM/StreetView.pm +++ b/perllib/FixMyStreet/Map/OSM/StreetView.pm @@ -40,8 +40,6 @@ sub display_map { my $out = ''; my $copyright = _('Map contains Ordnance Survey data © Crown copyright and database right 2010.'); $out .= <<EOF; -<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}"> <script type="text/javascript"> var fixmystreet = { 'latitude': $params{latitude}, diff --git a/perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm b/perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm index fc57b8d9d..d8ce80fab 100644 --- a/perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm +++ b/perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm @@ -49,8 +49,6 @@ sub display_map { my $sf = SCALE_FACTOR / TILE_WIDTH; my $copyright = _('© Crown copyright. All rights reserved. Ministry of Justice 100037819 2008.'); $out .= <<EOF; -<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}"> <script type="text/javascript"> var fixmystreet = { 'tilewidth': $tile_width, diff --git a/perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm b/perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm index 0ff556a17..74dd315bb 100644 --- a/perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm +++ b/perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm @@ -49,8 +49,6 @@ sub display_map { my $sf = SCALE_FACTOR / TILE_WIDTH; my $copyright = _('Map contains Ordnance Survey data © Crown copyright and database right 2010.'); $out .= <<EOF; -<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}"> <script type="text/javascript"> var fixmystreet = { 'tilewidth': $tile_width, diff --git a/perllib/FixMyStreet/Map/Tilma/Original.pm b/perllib/FixMyStreet/Map/Tilma/Original.pm index f1bf054f7..bf55e51eb 100644 --- a/perllib/FixMyStreet/Map/Tilma/Original.pm +++ b/perllib/FixMyStreet/Map/Tilma/Original.pm @@ -102,8 +102,6 @@ sub display_map { $out .= <<EOF; <input type="hidden" name="x" id="formX" value="$x"> <input type="hidden" name="y" id="formY" value="$y"> -<input type="hidden" name="latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" value="$params{longitude}"> EOF $img_type = '<input type="image"'; } else { diff --git a/t/app/controller/around.t b/t/app/controller/around.t index 069ec605a..76f504d7e 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -75,18 +75,18 @@ foreach my $test ( foreach my $test ( { pc => 'SW1A 1AA', - latitude => '51.5010096115539', - longitude => '-0.141587067110009', + latitude => '51.50101', + longitude => '-0.141587', }, { pc => 'Manchester', - latitude => '53.4807125', - longitude => '-2.2343765', + latitude => '53.480713', + longitude => '-2.234376', }, { pc => 'Glenthorpe Rd, Merton, Greater London SM4 4, UK', - latitude => '51.3937997', - longitude => '-0.2209596', + latitude => '51.3938', + longitude => '-0.22096', }, ) { diff --git a/templates/web/default/around/display_location.html b/templates/web/default/around/display_location.html index 58714f38e..b46b242d6 100755 --- a/templates/web/default/around/display_location.html +++ b/templates/web/default/around/display_location.html @@ -40,6 +40,9 @@ <input type="hidden" name="pc" value="[% pc | html %]"> [% c.cobrand.form_elements('mapForm') %] +<input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% short_latitude | html %]"> +<input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% short_longitude | html %]"> + [% map_html %] <p id='sub_map_links'> diff --git a/templates/web/default/report/new/fill_in_details.html b/templates/web/default/report/new/fill_in_details.html index 7c66dc7d5..1016a1ede 100644 --- a/templates/web/default/report/new/fill_in_details.html +++ b/templates/web/default/report/new/fill_in_details.html @@ -8,13 +8,14 @@ [% c.cobrand.form_elements('mapForm') %] [% ELSE %] <form action="[% c.uri_for('/report/new') %]" method="post" name="mapSkippedForm"[% IF c.cobrand.allow_photo_upload %] enctype="multipart/form-data"[% END %]> -<input type="hidden" name="latitude" value="[% latitude | html %]"> -<input type="hidden" name="longitude" value="[% longitude | html %]"> <input type="hidden" name="pc" value="[% pc | html %]"> <input type="hidden" name="skipped" value="1"> [% c.cobrand.form_elements('mapSkippedForm') %] [% 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 %]"> + [% map_html %] [% IF report.used_map %] |