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

View File

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