aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2014-04-02 17:06:21 +0100
committerStruan Donald <struan@exo.org.uk>2014-04-02 17:06:21 +0100
commit1218cda7e6ef2978a3459de8b34c7f29ad97a0a7 (patch)
tree4c63570a4a192a746df22c7785d137309e200a25 /src/js
parent84ba5e78c872681e735f8f0e6a3cd12380892e45 (diff)
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
Diffstat (limited to 'src/js')
-rw-r--r--src/js/views/around.js13
1 files changed, 12 insertions, 1 deletions
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('<p>' + msg + '</p>');
$('#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();