aboutsummaryrefslogtreecommitdiffstats
path: root/www/js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-06-19 13:50:36 +0100
committerStruan Donald <struan@exo.org.uk>2013-06-19 13:50:36 +0100
commit7b3875984223b811a69fd914a17b87bc31086ba2 (patch)
tree5b3f46b04ba760e86ad184934311fb567a4233ae /www/js
parentac5ac87248040e10f035154f6c17d91340b21c00 (diff)
if a list of user titles is provided by the server ask for and require one
Diffstat (limited to 'www/js')
-rw-r--r--www/js/models/report.js3
-rw-r--r--www/js/views/around.js3
-rw-r--r--www/js/views/submit.js13
3 files changed, 18 insertions, 1 deletions
diff --git a/www/js/models/report.js b/www/js/models/report.js
index 4b4473b..9ddcc66 100644
--- a/www/js/models/report.js
+++ b/www/js/models/report.js
@@ -66,7 +66,8 @@
used_map: 1,
name: model.get('name') || model.get('user').get('name'),
email: model.get('email') || model.get('user').get('email'),
- phone: model.get('phone')
+ phone: model.get('phone'),
+ fms_extra_title: model.get('user').get('title')
};
var extra_fields = model.get('extra_details');
diff --git a/www/js/views/around.js b/www/js/views/around.js
index 834c442..83df50b 100644
--- a/www/js/views/around.js
+++ b/www/js/views/around.js
@@ -197,6 +197,9 @@
this.model.set('lat', info.coordinates.latitude );
this.model.set('lon', info.coordinates.longitude );
this.model.set('categories', info.details.category );
+ if ( info.details.title_list ) {
+ this.model.set('title_list', info.details.title_list);
+ }
FMS.saveCurrentDraft();
this.navigate( 'photo' );
diff --git a/www/js/views/submit.js b/www/js/views/submit.js
index c905e7e..3f4a035 100644
--- a/www/js/views/submit.js
+++ b/www/js/views/submit.js
@@ -199,6 +199,13 @@
}
}
+ if ( this.model.get('title_list') && this.model.get('title_list').length > 0 ) {
+ if ( $('#form_title').val() === '' ) {
+ this.validationError('form_title', FMS.strings.required);
+ isValid = 0;
+ }
+ }
+
return isValid;
},
@@ -207,6 +214,9 @@
this.model.set('submit_clicked', 'submit_register');
FMS.currentUser.set('name', $('#form_name').val());
FMS.currentUser.set('phone', $('#form_phone').val());
+ if ( this.model.get('title_list') && this.model.get('title_list').length > 0 ) {
+ FMS.currentUser.set('title', $('#form_title').val());
+ }
this.navigate( 'submit-set-password' );
}
},
@@ -215,6 +225,9 @@
this.model.set('name', $('#form_name').val());
this.model.set('phone', $('#form_phone').val());
this.model.set('may_show_name', $('#form_may_show_name').val());
+ if ( this.model.get('title_list') && this.model.get('title_list').length > 0 ) {
+ FMS.currentUser.set('title', $('#form_title').val());
+ }
}
})
});