diff options
author | Struan Donald <struan@exo.org.uk> | 2013-06-24 16:44:26 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-06-24 18:23:47 +0100 |
commit | e7bf9b7aab7e5ed61942f3f159dbbd831781f3be (patch) | |
tree | 948824e41e24570a88a314c72184a102c900e3dd | |
parent | 602f5b9e616745124c33b30996c2c787fe5bb29b (diff) |
if initial geolocation fails then display a message on the map screen
rather than a whole new page
-rw-r--r-- | www/css/fms.css | 6 | ||||
-rw-r--r-- | www/js/strings.js | 2 | ||||
-rw-r--r-- | www/js/views/around.js | 17 |
3 files changed, 20 insertions, 5 deletions
diff --git a/www/css/fms.css b/www/css/fms.css index 3f1a82f..499b4fe 100644 --- a/www/css/fms.css +++ b/www/css/fms.css @@ -238,6 +238,12 @@ .frontpage-menu{ padding: 0px; } + + #front-howto { + padding: 0.3em; + background-color: rgba(255,255,255,0.8); + } + .nodisplay { display: none; } 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('<p>' + msg + '</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('<p>Multiple matches found</p><ul data-role="listview" data-inset="true">' + multiple + '</ul>'); $('.ui-page').trigger('create'); + $('#relocate').hide(); $('#front-howto').show(); } else { this.validationError( 'pc', FMS.strings.location_problem ); |