From 1efb700ed8e28ddc44c8cadaa0a8aefefc13d5a6 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Fri, 30 Apr 2010 21:34:28 +0100 Subject: [PATCH] enable and disable the form fields upon the checkbox change --- deluge/plugins/label/label/data/label.js | 27 ++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/deluge/plugins/label/label/data/label.js b/deluge/plugins/label/label/data/label.js index 827053a09..e5d564f87 100644 --- a/deluge/plugins/label/label/data/label.js +++ b/deluge/plugins/label/label/data/label.js @@ -132,7 +132,10 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { items: [{ xtype: 'checkbox', fieldLabel: '', - boxLabel: _('Apply per torrent max settings:') + boxLabel: _('Apply per torrent max settings:'), + listeners: { + check: this.onFieldChecked + } }] }, { xtype: 'fieldset', @@ -178,7 +181,10 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { items: [{ xtype: 'checkbox', fieldLabel: '', - boxLabel: _('Apply queue settings:') + boxLabel: _('Apply queue settings:'), + listeners: { + check: this.onFieldChecked + } }] }, { xtype: 'fieldset', @@ -216,7 +222,10 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { items: [{ xtype: 'checkbox', fieldLabel: '', - boxLabel: _('Apply location settings:') + boxLabel: _('Apply location settings:'), + listeners: { + check: this.onFieldChecked + } }] }, { xtype: 'fieldset', @@ -252,7 +261,10 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { items: [{ xtype: 'checkbox', fieldLabel: '', - boxLabel: _('Automatically apply label:') + boxLabel: _('Automatically apply label:'), + listeners: { + check: this.onFieldChecked + } }] }, { xtype: 'fieldset', @@ -289,6 +301,13 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { onOkClick: function() { this.hide(); + }, + + onFieldChecked: function(field, checked) { + var fs = field.ownerCt.nextSibling(); + fs.items.each(function(field) { + field.setDisabled(!checked); + }); } });