diff --git a/admin/javascript/SecurityAdmin.js b/admin/javascript/SecurityAdmin.js index 90c494715..7b1f901e3 100644 --- a/admin/javascript/SecurityAdmin.js +++ b/admin/javascript/SecurityAdmin.js @@ -60,15 +60,15 @@ if(this.is(':checked')) { checkboxes.each(function() { - $(this).data('SecurityAdmin.oldChecked', $(this).attr('checked')); - $(this).data('SecurityAdmin.oldDisabled', $(this).attr('disabled')); - $(this).attr('disabled', 'disabled'); - $(this).attr('checked', 'checked'); + $(this).data('SecurityAdmin.oldChecked', $(this).is(':checked')); + $(this).data('SecurityAdmin.oldDisabled', $(this).is(':disabled')); + $(this).prop('disabled', true); + $(this).prop('checked', true); }); } else { checkboxes.each(function() { - $(this).attr('checked', $(this).data('SecurityAdmin.oldChecked')); - $(this).attr('disabled', $(this).data('SecurityAdmin.oldDisabled')); + $(this).prop('checked', $(this).data('SecurityAdmin.oldChecked')); + $(this).prop('disabled', $(this).data('SecurityAdmin.oldDisabled')); }); } } diff --git a/javascript/PermissionCheckboxSetField.js b/javascript/PermissionCheckboxSetField.js index 5e234befe..04205e95e 100644 --- a/javascript/PermissionCheckboxSetField.js +++ b/javascript/PermissionCheckboxSetField.js @@ -10,8 +10,6 @@ $('.permissioncheckboxset .valADMIN input').entwine({ onmatch: function() { this._super(); - - this.toggleCheckboxes(); }, onunmatch: function() { this._super(); @@ -55,30 +53,29 @@ }).find('.checkbox').not(this); }, onmatch: function() { - var checkboxes = this.getCheckboxesExceptThisOne(); - if($(this).is(':checked')) { - checkboxes.each(function() { - $(this).attr('disabled', 'disabled'); - $(this).attr('checked', 'checked'); - }); - } - + this.toggleCheckboxes(); + this._super(); }, onunmatch: function() { this._super(); }, onclick: function(e) { + this.toggleCheckboxes(); + }, + toggleCheckboxes: function() { var checkboxes = this.getCheckboxesExceptThisOne(); if($(this).is(':checked')) { checkboxes.each(function() { - $(this).attr('disabled', 'disabled'); - $(this).attr('checked', 'checked'); + $(this).data('PermissionCheckboxSetField.oldChecked', $(this).is(':checked')); + $(this).data('PermissionCheckboxSetField.oldDisabled', $(this).is(':disabled')); + $(this).prop('disabled', 'disabled'); + $(this).prop('checked', 'checked'); }); } else { checkboxes.each(function() { - $(this).prop('checked', false); - $(this).prop('disabled', false); + $(this).prop('checked', $(this).data('PermissionCheckboxSetField.oldChecked')); + $(this).prop('disabled', $(this).data('PermissionCheckboxSetField.oldDisabled')); }); } }