silverstripe-cms/javascript/SitetreeAccess.js
Sam Minnee 54d4d66f72 BUGFIX: Debugged and simplified Access tab javascript
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@99594 467b73ca-7a2a-4603-9d3b-597d59a354a9
2011-02-02 17:52:58 +13:00

19 lines
529 B
JavaScript

/**
* UI behaviour for the "Access" tab
*/
var siteTreeAccessHandler = function(canField, groupsField) {
var output = {}
output['#Form_EditForm_' + canField + ' input'] = {
initialize: function() {
if(this.checked) this.click();
},
onclick: function() {
$(groupsField).style.display = (this.value == 'OnlyTheseUsers') ? 'block' : 'none';
}
}
return output;
};
Behaviour.register(siteTreeAccessHandler('CanViewType', 'ViewerGroups'));
Behaviour.register(siteTreeAccessHandler('CanEditType', 'EditorGroups'));