diff options
-rw-r--r-- | www/css/fms.css | 17 | ||||
-rw-r--r-- | www/js/app.js | 2 | ||||
-rw-r--r-- | www/js/views/submit.js | 33 | ||||
-rw-r--r-- | www/templates/en/submit_email.html | 16 | ||||
-rw-r--r-- | www/templates/en/submit_name.html | 1 | ||||
-rw-r--r-- | www/templates/en/submit_set_password.html | 17 |
6 files changed, 73 insertions, 13 deletions
diff --git a/www/css/fms.css b/www/css/fms.css index 12ffe4b..d60c126 100644 --- a/www/css/fms.css +++ b/www/css/fms.css @@ -416,6 +416,23 @@ list-style: none; } + #password-options { + width: 100%; + } + + #password-options > div { + width: 100%; + } + + #password-options a { + border-radius: 0px !important; + width: 50%; + } + + #password-options .ui-btn-inner { + padding: 0.6em 0px; + } + .ui-loader { height: 100%; width: 100%; diff --git a/www/js/app.js b/www/js/app.js index 80f1f4b..5c3b655 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -38,7 +38,7 @@ var tpl = { (function (FMS, Backbone, _, $) { _.extend(FMS, { templates: [ - 'home', 'around', 'offline', 'save_offline', 'reports', 'login', 'address_search', 'existing', 'photo', 'details', 'details_extra', 'submit', 'submit_email', 'submit_name', 'submit_password', 'submit_confirm', 'sent' + 'home', 'around', 'offline', 'save_offline', 'reports', 'login', 'address_search', 'existing', 'photo', 'details', 'details_extra', 'submit', 'submit_email', 'submit_name', 'submit_set_password', 'submit_password', 'submit_confirm', 'sent' ], isLoggedIn: 0, diff --git a/www/js/views/submit.js b/www/js/views/submit.js index 3f4a035..6b7529e 100644 --- a/www/js/views/submit.js +++ b/www/js/views/submit.js @@ -119,6 +119,7 @@ 'pagebeforeshow': 'beforeDisplay', 'pageshow': 'afterDisplay', 'vclick .ui-btn-left': 'onClickButtonPrev', + 'vclick #set_password': 'onClickSetPassword', 'vclick #have_password': 'onClickPassword', 'vclick #email_confirm': 'onClickConfirm' }, @@ -140,6 +141,14 @@ return isValid; }, + onClickSetPassword: function(e) { + e.preventDefault(); + if ( this.validate() ) { + FMS.currentUser.set('email', $('#form_email').val()); + this.navigate( 'submit-set-password' ); + } + }, + onClickPassword: function(e) { e.preventDefault(); if ( this.validate() ) { @@ -307,9 +316,27 @@ (function (FMS, Backbone, _, $) { _.extend( FMS, { SubmitSetPasswordView: FMS.SubmitPasswordView.extend({ - template: 'submit_password', - id: 'submit--set-password-page', - prev: 'submit-name' + template: 'submit_set_password', + id: 'submit-set-password-page', + prev: 'submit-email', + next: 'submit-name', + + events: { + 'pagehide': 'destroy', + 'pagebeforeshow': 'beforeDisplay', + 'pageshow': 'afterDisplay', + 'vclick .ui-btn-left': 'onClickButtonPrev', + 'vclick #continue': 'onClickContinue', + 'submit #passwordForm': 'onClickContinue' + }, + + onClickContinue: function(e) { + e.preventDefault(); + $('#continue').focus(); + this.model.set('submit_clicked', 'submit_sign_in'); + FMS.currentUser.set('password', $('#form_password').val()); + this.navigate( this.next ); + } }) }); })(FMS, Backbone, _, $); diff --git a/www/templates/en/submit_email.html b/www/templates/en/submit_email.html index 6de8a21..b9191ff 100644 --- a/www/templates/en/submit_email.html +++ b/www/templates/en/submit_email.html @@ -8,19 +8,19 @@ <input data-role="none" type="email" value="<%= user.email %>" name="email" id="form_email" placeholder="Please enter your email address" required> </div> </div> - <input data-role="button" data-theme="a" type="button" id="have_password" name="have_password" value="I have a password"> - <input data-role="button" data-theme="a" type="button" id="email_confirm" name="email_confirm" value="I don't"> <p> - To make a report on FixMyStreet we require you to confirm your email address either by setting up - an account, or clicking a link in an email we send you. + We will email a confirmation message and any updates to the report </p> - - <p> - If you have a FixMyStreet account then choose "I have a password", otherwise choose "I don't". </p> <p> - If you choose "I don't" then you can, if you want, set a password. + To speed up adding reports in future you can optionally set a password and save your details. If you already have an account press sign-in. </p> + + <div id="password-options" data-role="controlgroup" data-type="horizontal"> + <a data-role="button" data-corners="false" data-theme="c" id="set_password" name="set_password">Set a password</a> + <a data-role="button" data-corners="false" data-theme="c" id="have_password" name="have_password">Sign-in</a> + </div> + <input data-role="button" data-theme="a" type="button" id="email_confirm" name="email_confirm" value="Continue without a password"> </div> diff --git a/www/templates/en/submit_name.html b/www/templates/en/submit_name.html index dbc0b63..6e192dd 100644 --- a/www/templates/en/submit_name.html +++ b/www/templates/en/submit_name.html @@ -27,5 +27,4 @@ </div> </div> <input data-role="button" data-theme="a" type="button" id="send_confirm" name="send_confirm" value="Send confirmation email"> - <input data-role="button" data-theme="a" type="button" id="set_password" name="set_password" value="Set a password"> </div> diff --git a/www/templates/en/submit_set_password.html b/www/templates/en/submit_set_password.html new file mode 100644 index 0000000..5d63c0a --- /dev/null +++ b/www/templates/en/submit_set_password.html @@ -0,0 +1,17 @@ +<div id="submit-header" data-role="header"> + <h1>Your details</h1> +</div> + +<div data-role="content"> + <div id="errors"></div> + <form id="passwordForm" name="passwordForm"> + <div id="password_row"> + <div class="inputcard"> + <div> + <input data-role="none" type="password" value="" name="password" id="form_password" placeholder="Your password" required> + </div> + </div> + <input data-role="button" data-theme="a" type="submit" id="continue" name="report" value="Continue"> + </div> + </form> +</div> |