aboutsummaryrefslogtreecommitdiffstats
path: root/www/js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-06-04 16:21:09 +0100
committerStruan Donald <struan@exo.org.uk>2013-06-04 16:21:09 +0100
commit5224be83b704e2244a91723b8a96f4e0a705ca5a (patch)
tree1b16c34897108104bf984b69502aa5277d60850e /www/js
parent5735733001182a04dfe438a4623b58b58176a9a4 (diff)
correctly set details category select class based on value. Fixes #435
Diffstat (limited to 'www/js')
-rw-r--r--www/js/views/details.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/www/js/views/details.js b/www/js/views/details.js
index 1cd0efd..17f8d68 100644
--- a/www/js/views/details.js
+++ b/www/js/views/details.js
@@ -13,18 +13,18 @@
'click .ui-btn-left': 'onClickButtonPrev',
'click .ui-btn-right': 'onClickButtonNext',
'blur textarea': 'updateCurrentReport',
- 'change select': 'updateCurrentReport',
+ 'change select': 'updateSelect',
'blur input': 'updateCurrentReport'
},
afterRender: function() {
+ this.$('#form_category').attr('data-role', 'none');
+
if ( this.model.get('category') ) {
this.$('#form_category').val( this.model.get('category') );
+ this.setSelectClass();
}
- this.$('#form_category')
- .attr('data-role', 'none')
- .addClass('noselection');
},
afterDisplay: function() {
@@ -73,6 +73,20 @@
}
},
+ setSelectClass: function() {
+ var cat = $('#form_category');
+ if ( cat.val() !== "" && cat.val() !== '-- Pick a category --' ) {
+ cat.removeClass('noselection');
+ } else {
+ cat.addClass('noselection');
+ }
+ },
+
+ updateSelect: function() {
+ this.updateCurrentReport();
+ this.setSelectClass();
+ },
+
updateCurrentReport: function() {
if ( $('#form_category').val() && $('#form_title').val() && $('#form_detail').val() ) {
$('#next').addClass('page_complete_btn');