MINOR Fixed CreateToplevelGroups toggling in CMSMain.EditForm.js

This commit is contained in:
Ingo Schommer 2011-04-30 18:34:52 +12:00
parent bf8bc1d856
commit 4f157e3133
1 changed files with 4 additions and 3 deletions

View File

@ -173,21 +173,22 @@
* Toggle display of group dropdown in "access" tab,
* based on selection of radiobuttons.
*/
$('.cms-edit-form #CanViewType, .cms-edit-form #CanEditType').entwine({
$('.cms-edit-form #CanViewType, .cms-edit-form #CanEditType, .cms-edit-form #CanCreateTopLevelType').entwine({
// Constructor: onmatch
onmatch: function() {
// TODO Decouple
var dropdown;
if(this.attr('id') == 'CanViewType') dropdown = $('#ViewerGroups');
else if(this.attr('id') == 'CanEditType') dropdown = $('#EditorGroups');
else if(this.attr('id') == 'CanCreateTopLevelType') dropdown = $('#CreateTopLevelGroups');
this.find('.optionset :input').bind('change', function(e) {
dropdown.toggle(e.target.value == 'OnlyTheseUsers');
dropdown[e.target.value == 'OnlyTheseUsers' ? 'show' : 'hide']();
});
// initial state
var currentVal = this.find('input[name=' + this.attr('id') + ']:checked').val();
dropdown.toggle(currentVal == 'OnlyTheseUsers');
dropdown[currentVal == 'OnlyTheseUsers' ? 'show' : 'hide']();
this._super();
}