enable and disable the form fields upon the checkbox change

This commit is contained in:
Damien Churchill 2010-04-30 21:34:28 +01:00
parent e0153e8bdc
commit 1efb700ed8
1 changed files with 23 additions and 4 deletions

View File

@ -132,7 +132,10 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
items: [{ items: [{
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Apply per torrent max settings:') boxLabel: _('Apply per torrent max settings:'),
listeners: {
check: this.onFieldChecked
}
}] }]
}, { }, {
xtype: 'fieldset', xtype: 'fieldset',
@ -178,7 +181,10 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
items: [{ items: [{
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Apply queue settings:') boxLabel: _('Apply queue settings:'),
listeners: {
check: this.onFieldChecked
}
}] }]
}, { }, {
xtype: 'fieldset', xtype: 'fieldset',
@ -216,7 +222,10 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
items: [{ items: [{
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Apply location settings:') boxLabel: _('Apply location settings:'),
listeners: {
check: this.onFieldChecked
}
}] }]
}, { }, {
xtype: 'fieldset', xtype: 'fieldset',
@ -252,7 +261,10 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
items: [{ items: [{
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Automatically apply label:') boxLabel: _('Automatically apply label:'),
listeners: {
check: this.onFieldChecked
}
}] }]
}, { }, {
xtype: 'fieldset', xtype: 'fieldset',
@ -289,6 +301,13 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
onOkClick: function() { onOkClick: function() {
this.hide(); this.hide();
},
onFieldChecked: function(field, checked) {
var fs = field.ownerCt.nextSibling();
fs.items.each(function(field) {
field.setDisabled(!checked);
});
} }
}); });