BUGFIX #5485 PermissionCheckboxSetField javascript would always uncheck all CMS_ACCESS_* permission checkboxes on initialize event

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@103674 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-04-28 07:29:22 +00:00 committed by Sam Minnee
parent e80b87f1c0
commit 2b851358be

View File

@ -40,17 +40,22 @@
* instead of custom logic.
*/
'.permissioncheckboxset .valCMS_ACCESS_LeftAndMain input': {
initialize: function() {
this.toggleCheckboxes();
},
onclick: function(e) {
this.toggleCheckboxes();
},
toggleCheckboxes: function() {
var checkboxes = $(this).parents('.field:eq(0)').find('li').filter(function(i) {
getCheckboxesExceptThisOne: function() {
return $(this).parents('.field:eq(0)').find('li').filter(function(i) {
return ($(this).attr('class').match(/CMS_ACCESS_/));
}).find('.checkbox').not(this);
},
initialize: function() {
var checkboxes = this.getCheckboxesExceptThisOne();
if($(this).is(':checked')) {
checkboxes.each(function() {
$(this).attr('disabled', 'disabled');
$(this).attr('checked', 'checked');
});
}
},
onclick: function(e) {
var checkboxes = this.getCheckboxesExceptThisOne();
if($(this).is(':checked')) {
checkboxes.each(function() {
$(this).attr('disabled', 'disabled');