diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet/staff.js | 29 | ||||
-rw-r--r-- | web/cobrands/isleofwight/assets.js | 15 |
2 files changed, 28 insertions, 16 deletions
diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js index b074a49f3..17bd54b8b 100644 --- a/web/cobrands/fixmystreet/staff.js +++ b/web/cobrands/fixmystreet/staff.js @@ -261,19 +261,22 @@ fixmystreet.staff_set_up = { if ('geolocation' in navigator) { var el = document.querySelector('.btn--geolocate'); - fixmystreet.geolocate(el, function(pos) { - var latlon = new OpenLayers.LonLat(pos.coords.longitude, pos.coords.latitude); - var bng = latlon.clone().transform( - new OpenLayers.Projection("EPSG:4326"), - new OpenLayers.Projection("EPSG:27700") // TODO: Handle other projections - ); - $("#problem_northing").text(bng.lat.toFixed(1)); - $("#problem_easting").text(bng.lon.toFixed(1)); - $("#problem_latitude").text(latlon.lat.toFixed(6)); - $("#problem_longitude").text(latlon.lon.toFixed(6)); - $inspect_form.find("input[name=latitude]").val(latlon.lat); - $inspect_form.find("input[name=longitude]").val(latlon.lon); - }); + // triage pages may not show geolocation button + if (el) { + fixmystreet.geolocate(el, function(pos) { + var latlon = new OpenLayers.LonLat(pos.coords.longitude, pos.coords.latitude); + var bng = latlon.clone().transform( + new OpenLayers.Projection("EPSG:4326"), + new OpenLayers.Projection("EPSG:27700") // TODO: Handle other projections + ); + $("#problem_northing").text(bng.lat.toFixed(1)); + $("#problem_easting").text(bng.lon.toFixed(1)); + $("#problem_latitude").text(latlon.lat.toFixed(6)); + $("#problem_longitude").text(latlon.lon.toFixed(6)); + $inspect_form.find("input[name=latitude]").val(latlon.lat); + $inspect_form.find("input[name=longitude]").val(latlon.lon); + }); + } } // Make the "Provide an update" form toggleable, hidden by default. diff --git a/web/cobrands/isleofwight/assets.js b/web/cobrands/isleofwight/assets.js index 3df034f0c..a68b0418b 100644 --- a/web/cobrands/isleofwight/assets.js +++ b/web/cobrands/isleofwight/assets.js @@ -97,17 +97,26 @@ fixmystreet.assets.add($.extend(true, {}, defaults, { }) })); +function not_found_msg_update() { + $('.category_meta_message').html('Please select an item or a road/pavement/path on the map »'); + $('.category_meta_message').removeClass('meta-highlight'); + $("input[name=asset_details]").val(''); +} + function found_item(layer, asset) { var id = asset.attributes.central_asset_id || ''; if (id !== '') { var attrib = asset.attributes; var asset_name = attrib.feature_type_name + '; ' + attrib.site_name + '; ' + attrib.feature_location; $('.category_meta_message').html('You have selected ' + asset_name); + $('.category_meta_message').addClass('meta-highlight'); + $("input[name=asset_details]").val(asset_name); } else { - $('.category_meta_message').html('Please select an item or a road/pavement/path on the map »'); + not_found_msg_update(); } } + var point_asset_defaults = $.extend(true, {}, defaults, { snap_threshold: 5, select_action: true, @@ -118,7 +127,7 @@ var point_asset_defaults = $.extend(true, {}, defaults, { found_item(this, asset); }, asset_not_found: function() { - $('.category_meta_message').html('Please select an item or a road/pavement/path on the map »'); + not_found_msg_update(); } } @@ -145,7 +154,7 @@ var line_asset_defaults = $.extend(true, {}, defaults, { if ( fixmystreet.assets.selectedFeature() ) { return; } - $('.category_meta_message').html('Please select an item or a road/pavement/path on the map »'); + not_found_msg_update(); } } }); |