diff options
author | Struan Donald <struan@exo.org.uk> | 2014-04-03 11:19:19 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2014-04-03 11:19:19 +0100 |
commit | 99b5f408be0aee9b553c852080bf6a87cbe3b5f1 (patch) | |
tree | 9edd57528a712338c52a0e877262293ce8e6fb16 | |
parent | 0bcbd779222f31c8115009a73ba6e1d70ade28c6 (diff) |
Need to confirm title on password screen as well
Yet another place where we confirm the name and hence need to confirm
the title if required
-rw-r--r-- | src/js/views/submit.js | 10 | ||||
-rw-r--r-- | src/templates/en/submit_password.html | 8 | ||||
-rw-r--r-- | templates/submit_password.html | 8 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/js/views/submit.js b/src/js/views/submit.js index 647edec..6a7c946 100644 --- a/src/js/views/submit.js +++ b/src/js/views/submit.js @@ -336,6 +336,13 @@ this.validationError('form_password', FMS.validationStrings.password ); } + if ( $('#form_name').val() && this.model.get('titles_list') && this.model.get('titles_list').length > 0 ) { + if ( $('#form_title').val() === '' ) { + this.validationError('form_title', FMS.strings.required); + isValid = 0; + } + } + return isValid; }, @@ -350,6 +357,9 @@ this.model.set('may_show_name', $('#form_may_show_name').is(':checked')); FMS.currentUser.set('name', $('#form_name').val()); FMS.currentUser.set('may_show_name', $('#form_may_show_name').is(':checked')); + if ( this.model.get('titles_list') && this.model.get('titles_list').length > 0 ) { + FMS.currentUser.set('title', $('#form_title').val()); + } FMS.currentUser.save(); } else { // if this is set then we are registering a password diff --git a/src/templates/en/submit_password.html b/src/templates/en/submit_password.html index c2708da..fb61d20 100644 --- a/src/templates/en/submit_password.html +++ b/src/templates/en/submit_password.html @@ -21,6 +21,14 @@ Please confirm your name, if you want it to be public and optionally your phone number. </p> + <% if ( typeof model.titles_list !== 'undefined' ) { %> + <div> + <select data-role="none" placeholder="Title" id="form_title" name="title" required> + <option value="">Title</option> + <% for ( var i = 0; i < model.titles_list.length; i++ ) { var title = model.titles_list[i]; print( '<option value="' + title + '"' + ( user.title && user.title == title ? ' selected' : '' ) + '>' + title + '</option>' ); } %> + </select> + </div> + <% } %> <div> <input data-role="none" type="text" value="" id="form_name" name="name"> </div> diff --git a/templates/submit_password.html b/templates/submit_password.html index 3251329..baf2e52 100644 --- a/templates/submit_password.html +++ b/templates/submit_password.html @@ -21,6 +21,14 @@ [% loc('Please confirm your name, if you want it to be public and optionally your phone number.') %] </p> + <% if ( typeof model.titles_list !== 'undefined' ) { %> + <div> + <select data-role="none" placeholder="[% loc('Title') %]" id="form_title" name="title" required> + <option value="">[% loc('Title') %]</option> + <% for ( var i = 0; i < model.titles_list.length; i++ ) { var title = model.titles_list[i]; print( '<option value="' + title + '"' + ( user.title && user.title == title ? ' selected' : '' ) + '>' + title + '</option>' ); } %> + </select> + </div> + <% } %> <div> <input data-role="none" type="text" value="" id="form_name" name="name"> </div> |