FIX: Incorrect field IDs breaking SiteTree settings toggles (fixes #1280)

This commit is contained in:
Loz Calver 2015-09-23 14:53:07 +01:00
parent f2efbefb8c
commit 052aba17ac

View File

@ -169,7 +169,7 @@
// otherwise use the old value // otherwise use the old value
else this.find(':input[name=ParentID]').val(this.find('#Form_EditForm_ParentType_subpage').data('parentIdValue')); else this.find(':input[name=ParentID]').val(this.find('#Form_EditForm_ParentType_subpage').data('parentIdValue'));
// toggle tree dropdown based on selection // toggle tree dropdown based on selection
this.find('#ParentID').toggle(selected != 'root'); this.find('#Form_EditForm_ParentID_Holder').toggle(selected != 'root');
}, },
/** /**
@ -196,9 +196,9 @@
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 = $('#Form_EditForm_ViewerGroups_Holder');
else if(this.attr('id') == 'CanEditType') dropdown = $('#EditorGroups'); else if(this.attr('id') == 'CanEditType') dropdown = $('#Form_EditForm_EditorGroups_Holder');
else if(this.attr('id') == 'CanCreateTopLevelType') dropdown = $('#CreateTopLevelGroups'); else if(this.attr('id') == 'CanCreateTopLevelType') dropdown = $('#Form_EditForm_CreateTopLevelGroups_Holder');
this.find('.optionset :input').bind('change', function(e) { this.find('.optionset :input').bind('change', function(e) {
var wrapper = $(this).closest('.middleColumn').parent('div'); var wrapper = $(this).closest('.middleColumn').parent('div');
@ -451,7 +451,7 @@
this._super(); this._super();
}, },
redraw: function() { redraw: function() {
var treeField = $('.cms-edit-form.CMSPageSettingsController #ParentID'); var treeField = $('.cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder');
if ($(this).attr('id') == 'Form_EditForm_ParentType_root') treeField.slideUp(); if ($(this).attr('id') == 'Form_EditForm_ParentType_root') treeField.slideUp();
else treeField.slideDown(); else treeField.slideDown();
}, },
@ -462,7 +462,7 @@
//trigger an initial change event to do the initial hiding of the element, if necessary //trigger an initial change event to do the initial hiding of the element, if necessary
if ($('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr('id') == 'Form_EditForm_ParentType_root') { if ($('.cms-edit-form.CMSPageSettingsController input[name="ParentType"]:checked').attr('id') == 'Form_EditForm_ParentType_root') {
$('.cms-edit-form.CMSPageSettingsController #ParentID').hide(); //quick hide on first run $('.cms-edit-form.CMSPageSettingsController #Form_EditForm_ParentID_Holder').hide(); //quick hide on first run
} }
}); });
}(jQuery)); }(jQuery));