From e7bf9b7aab7e5ed61942f3f159dbbd831781f3be Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 24 Jun 2013 16:44:26 +0100 Subject: if initial geolocation fails then display a message on the map screen rather than a whole new page --- www/js/strings.js | 2 +- www/js/views/around.js | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'www/js') diff --git a/www/js/strings.js b/www/js/strings.js index 6ef6f54..081fd76 100644 --- a/www/js/strings.js +++ b/www/js/strings.js @@ -31,7 +31,7 @@ report_send_error: 'There was a problem submitting your report. Please try again', missing_location: 'Please enter a location', location_check_failed: 'Could not check your location', - geolocation_failed: 'Could not determine your location', + geolocation_failed: 'Could not determine your location, please search for a location instead.', geolocation_denied: 'Could not access location services. Please check permissions.', select_category: '-- Pick a categoy --', required: 'required', diff --git a/www/js/views/around.js b/www/js/views/around.js index ad5533c..61b3757 100644 --- a/www/js/views/around.js +++ b/www/js/views/around.js @@ -120,12 +120,15 @@ failedLocation: function( details ) { this.finishedLocating(); this.locateCount = 21; + var msg = ''; if ( details.msg ) { - FMS.searchMessage = details.msg; + msg = details.msg; } else { - FMS.searchMessage = FMS.strings.location_problem; + msg = FMS.strings.location_problem; } - this.navigate('search'); + $('#front-howto').html('

' + msg + ''); + $('#relocate').hide(); // TODO: not sure we want to do this + $('#front-howto').show(); }, displayButtons: function() { @@ -236,10 +239,15 @@ searchSuccess: function( info ) { this.stopListening(FMS.locator); var coords = info.coordinates; - fixmystreet.map.panTo(this.projectCoords( coords )); + if ( fixmystreet.map ) { + fixmystreet.map.panTo(this.projectCoords( coords )); + } else { + this.gotLocation(info); + } }, goAddress: function(e) { + $('#relocate').show(); $('#front-howto').html('').hide(); var t = $(e.target); var lat = t.attr('data-lat'); @@ -264,6 +272,7 @@ } $('#front-howto').html('

Multiple matches found

'); $('.ui-page').trigger('create'); + $('#relocate').hide(); $('#front-howto').show(); } else { this.validationError( 'pc', FMS.strings.location_problem ); -- cgit v1.2.3