aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--www/js/router.js2
-rw-r--r--www/js/views/around.js13
-rw-r--r--www/js/views/fms.js13
-rw-r--r--www/js/views/search.js1
-rw-r--r--www/templates/en/address_search.html4
5 files changed, 24 insertions, 9 deletions
diff --git a/www/js/router.js b/www/js/router.js
index b85b361..f3153ba 100644
--- a/www/js/router.js
+++ b/www/js/router.js
@@ -38,7 +38,7 @@
},
search: function(){
- var searchView = new FMS.SearchView({ model: FMS.currentReport });
+ var searchView = new FMS.SearchView({ model: FMS.currentReport, msg: FMS.searchMessage });
this.changeView(searchView);
},
diff --git a/www/js/views/around.js b/www/js/views/around.js
index be1033b..23d7882 100644
--- a/www/js/views/around.js
+++ b/www/js/views/around.js
@@ -49,13 +49,16 @@
},
startLocateProgress: function() {
+ this.located = false;
this.locateCount = 1;
var that = this;
window.setTimeout( function() {that.showLocateProgress();}, 1000);
},
showLocateProgress: function() {
- if ( this.locateCount > 20 ) {
+ if ( !this.located && this.locateCount > 20 ) {
+ FMS.searchMessage = FMS.strings.geolocation_failed;
+ this.navigate('search');
return;
}
var percent = ( ( 20 - this.locateCount ) / 20 ) * 100;
@@ -72,6 +75,7 @@
this.listenTo(FMS.locator, 'gps_current_position', this.positionUpdate);
+ this.located = true;
this.locateCount = 21;
$('#ajaxOverlay').hide();
$('#locating').hide();
@@ -134,12 +138,11 @@
$('#locating').hide();
$('#ajaxOverlay').hide();
if ( details.msg ) {
- this.displayError( details.msg );
- } else if ( details.locs ) {
- this.displayError( FMS.strings.multiple_locations );
+ FMS.searchMessage = details.msg;
} else {
- this.displayError( FMS.strings.location_problem );
+ FMS.searchMessage = FMS.strings.location_problem;
}
+ this.navigate('search');
},
onClickReport: function() {
diff --git a/www/js/views/fms.js b/www/js/views/fms.js
index a1c6dd7..d701b00 100644
--- a/www/js/views/fms.js
+++ b/www/js/views/fms.js
@@ -16,11 +16,18 @@
return;
}
template = _.template( tpl.get( this.template ) );
+ var args = null;
+ if ( this.options.msg ) {
+ args = { msg: this.options.msg };
+ }
if ( this.model ) {
- this.$el.html(template(this.model.toJSON()));
- } else {
- this.$el.html(template());
+ if ( args ) {
+ args.model = this.model.toJSON();
+ } else {
+ args = this.model.toJSON();
+ }
}
+ this.$el.html(template(args));
this.afterRender();
return this;
},
diff --git a/www/js/views/search.js b/www/js/views/search.js
index a52f9cd..afe2bf4 100644
--- a/www/js/views/search.js
+++ b/www/js/views/search.js
@@ -61,6 +61,7 @@
},
destroy: function() {
+ delete FMS.searchMessage;
this.stopListening(FMS.locator);
}
})
diff --git a/www/templates/en/address_search.html b/www/templates/en/address_search.html
index 0ec4885..1ad2975 100644
--- a/www/templates/en/address_search.html
+++ b/www/templates/en/address_search.html
@@ -20,6 +20,9 @@
<div class="tablewrapper">
<div id="front-howto">
+ <% if (msg) { %>
+ <h2><%= msg %></h2>
+ <% } else { %>
<h2>How to report a problem</h2>
<ol class="big-numbers">
@@ -28,6 +31,7 @@
<li>Enter details of the problem</li>
<li>We send it to the council on your behalf</li>
</ol>
+ <% } %>
</div>
</div>
</div>