Module: deluge
Branch: master
Commit: 1efb700ed8e28ddc44c8cadaa0a8aefefc13d5a6

Author: Damien Churchill <[email protected]>
Date:   Fri Apr 30 21:34:28 2010 +0100

enable and disable the form fields upon the checkbox change

---

 deluge/plugins/label/label/data/label.js |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/deluge/plugins/label/label/data/label.js 
b/deluge/plugins/label/label/data/label.js
index 827053a..e5d564f 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);
+               });
        }
 
 });

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to