aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/js/views/submit.js10
-rw-r--r--src/templates/en/submit_password.html8
-rw-r--r--templates/submit_password.html8
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>