From 1218cda7e6ef2978a3459de8b34c7f29ad97a0a7 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 2 Apr 2014 17:06:21 +0100 Subject: Allow user to go offline if we can't check the location Not being able to check the location usually means the connection is not very good so the process isn't going to work too well so we should allow them to do something --- src/js/views/around.js | 13 ++++++++++++- src/templates/en/around.html | 3 +++ templates/around.html | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/js/views/around.js b/src/js/views/around.js index 57b4bc6..8f5c43a 100644 --- a/src/js/views/around.js +++ b/src/js/views/around.js @@ -20,6 +20,7 @@ 'vclick #mark-here': 'onClickMark', 'vclick #locate-here': 'onClickMark', 'vclick #reposition': 'onClickReposition', + 'vclick #go-offline': 'onClickGoOffline', 'vclick a.address': 'goAddress', 'submit #postcodeForm': 'search' }, @@ -186,9 +187,13 @@ $('#mark-here').hide(); // if we are going to display the help then we don't want to focus on // the search box as it will show through the help - if ( FMS.usedBefore ) { + if ( FMS.usedBefore && (details.err && ! details.err == 'location_check_failed') ) { $('#pc').attr('placeholder', FMS.strings.search_placeholder).focus(); } + + if ( details.err == 'location_check_failed' ) { + $('#go-offline').show(); + } } $('#front-howto').html('

' + msg + '

'); $('#front-howto').show(); @@ -203,6 +208,7 @@ }, displayButtons: function(isLocationSet) { + $('#go-offline').hide(); if ( fixmystreet.map ) { fixmystreet.nav.activate(); fixmystreet.actionafterdrag.activate(); @@ -287,6 +293,11 @@ this.displayButtons(false); }, + onClickGoOffline: function(e) { + e.preventDefault(); + this.navigate('offline'); + }, + decrementDraftCount: function() { var counter = $('#view-my-reports .draft_count'); var count = counter.text(); diff --git a/src/templates/en/around.html b/src/templates/en/around.html index 47bc329..8a427e2 100644 --- a/src/templates/en/around.html +++ b/src/templates/en/around.html @@ -49,5 +49,8 @@ Confirm Location + + Go Offline + diff --git a/templates/around.html b/templates/around.html index 6fb6ca9..b4cd68c 100644 --- a/templates/around.html +++ b/templates/around.html @@ -49,5 +49,8 @@ [% loc('Confirm Location') %] + + [% loc('Go Offline') %] + -- cgit v1.2.3