diff options
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/config.js-example | 7 | ||||
-rw-r--r-- | www/js/views/submit.js | 16 |
2 files changed, 21 insertions, 2 deletions
diff --git a/www/js/config.js-example b/www/js/config.js-example index 3ca674c..6be0250 100644 --- a/www/js/config.js-example +++ b/www/js/config.js-example @@ -64,7 +64,12 @@ var CONFIG = { // The ratio of the data bounds to the viewport bounds (in each dimension). // See http://dev.openlayers.org/releases/OpenLayers-2.13.1/doc/apidocs/files/OpenLayers/Strategy/BBOX-js.html - MAP_LOADING_RATIO: 2 + MAP_LOADING_RATIO: 2, + + // If the user is logged in and this setting is true, the 'Your details' + // page is skipped and the report is sent immediately after the report + // details have been entered. + SKIP_CONFIRM_REPORT: false }; diff --git a/www/js/views/submit.js b/www/js/views/submit.js index 6a7c946..edf6dd1 100644 --- a/www/js/views/submit.js +++ b/www/js/views/submit.js @@ -468,12 +468,26 @@ // TODO: this is a temporary measure which should be replaced by a more // sensible login mechanism if ( err.check_name ) { - this.onClickSubmit(); + this.doSubmit(); } else { if ( err.errors && err.errors.password ) { this.validationError('form_password', err.errors.password ); } } + }, + + afterRender: function() { + console.log("SubmitConfirmView.afterRender"); + if (CONFIG.SKIP_CONFIRM_REPORT) { + var that = this; + setTimeout(function() { + // This needs to be in a setTimeout call otherwise + // the app gets stuck on an empty "Your Details" page. + // This is something to do with the way Backbone routes + // between views, I believe. + that.doSubmit(); + }, 10); + } } }) }); |