aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/js/views/around.js13
-rw-r--r--src/templates/en/around.html3
-rw-r--r--templates/around.html3
3 files changed, 18 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();
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 @@
<a id="confirm-map" data-role="button" data-theme="a" class="map-bottom-btn">
Confirm Location
</a>
+ <a id="go-offline" data-role="button" data-theme="c" class="map-bottom-btn nodisplay">
+ Go Offline
+ </a>
</div>
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 @@
<a id="confirm-map" data-role="button" data-theme="a" class="map-bottom-btn">
[% loc('Confirm Location') %]
</a>
+ <a id="go-offline" data-role="button" data-theme="c" class="map-bottom-btn nodisplay">
+ [% loc('Go Offline') %]
+ </a>
</div>