aboutsummaryrefslogtreecommitdiffstats
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-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
4 files changed, 20 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);
}
})