mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
ENHANCEMENT Disabling/checking permission checkboxes in admin/security when 'ADMIN' permission is selected
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@99600 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ca3b8d5792
commit
f22f2e2a1b
@ -61,6 +61,37 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Automatically check and disable all checkboxes if ADMIN permissions are selected.
|
||||||
|
* As they're disabled, any changes won't be submitted (which is intended behaviour),
|
||||||
|
* checking all boxes is purely presentational.
|
||||||
|
*/
|
||||||
|
$('#Form_EditForm #Permissions .checkbox[value=ADMIN]').concrete({
|
||||||
|
onmatch: function() {
|
||||||
|
this.toggleCheckboxes();
|
||||||
|
|
||||||
|
this._super();
|
||||||
|
},
|
||||||
|
onclick: function(e) {
|
||||||
|
this.toggleCheckboxes();
|
||||||
|
},
|
||||||
|
toggleCheckboxes: function() {
|
||||||
|
var self = this, checkboxes = this.parents('.permissioncheckboxset:eq(0)').find('.checkbox').not(this);
|
||||||
|
if(this.is(':checked')) {
|
||||||
|
checkboxes.each(function() {
|
||||||
|
$(this).data('SecurityAdmin.oldChecked', $(this).attr('checked'));
|
||||||
|
$(this).attr('disabled', 'disabled');
|
||||||
|
$(this).attr('checked', 'checked');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
checkboxes.each(function() {
|
||||||
|
$(this).attr('checked', $(this).data('SecurityAdmin.oldChecked'));
|
||||||
|
$(this).attr('disabled', '');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}(jQuery));
|
}(jQuery));
|
Loading…
Reference in New Issue
Block a user