diff options
author | Dave Arter <davea@mysociety.org> | 2017-07-18 19:35:53 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2018-04-30 13:13:02 +0100 |
commit | 8d8e65fb32b47eeccb3b82ddd1111a8d24856a4d (patch) | |
tree | ec2563a5022ebb9bf51619f305a9a6b7d57e2c14 /www | |
parent | c4dcd37dede1a1736aa391a05c2020815390a79f (diff) |
Add CONFIG.SKIP_CONFIRM_REPORT to skip confirm page if logged in
Diffstat (limited to 'www')
-rw-r--r-- | www/css/fms.css | 4 | ||||
-rw-r--r-- | www/js/config.js-example | 7 | ||||
-rw-r--r-- | www/js/views/submit.js | 16 | ||||
-rw-r--r-- | www/templates/en/details_extra.html | 6 | ||||
-rw-r--r-- | www/templates/en/submit_confirm.html | 2 |
5 files changed, 31 insertions, 4 deletions
diff --git a/www/css/fms.css b/www/css/fms.css index dd2411f..9ed3fd0 100644 --- a/www/css/fms.css +++ b/www/css/fms.css @@ -948,3 +948,7 @@ top: 5px; right: 5px; } + + .ui-content.hidden { + visibility: hidden; + } 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); + } } }) }); diff --git a/www/templates/en/details_extra.html b/www/templates/en/details_extra.html index 339cc9d..c4390b4 100644 --- a/www/templates/en/details_extra.html +++ b/www/templates/en/details_extra.html @@ -1,7 +1,11 @@ <div data-role="header" data-position="fixed"> <a data-rel="back" data-icon="arrow-l" class="ui-btn-left">Back</a> <h1>Further Details</h1> - <a id="next" data-icon="arrow-r" data-iconpos="right" class="ui-btn-right">Next</a> + <% if (CONFIG.SKIP_CONFIRM_REPORT) { %> + <a id="next" class="ui-btn-right">Submit</a> + <% } else { %> + <a id="next" data-icon="arrow-r" data-iconpos="right" class="ui-btn-right">Next</a> + <% } %> </div> <div data-role="content" data-enhance="false"> <%= category_extras %> diff --git a/www/templates/en/submit_confirm.html b/www/templates/en/submit_confirm.html index 5d2e6a0..f41e71c 100644 --- a/www/templates/en/submit_confirm.html +++ b/www/templates/en/submit_confirm.html @@ -3,7 +3,7 @@ <h1>Your details</h1> </div> -<div data-role="content"> +<div data-role="content"<% if (CONFIG.SKIP_CONFIRM_REPORT) { %> class="hidden"<% } %>> <p class="notopmargin"> You are logged in as <%= user.email %>. </p> |