mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
Fix for 'Create' page dropdown not always updating when selecting a new page in the SiteTree
This was only updated when the 'Create' page options was open, so if you selected a different page and then clicked the 'Create' button it would have the original options
This commit is contained in:
parent
4ec85a412f
commit
f4b7fe05fa
@ -32,6 +32,7 @@ addpageclass.prototype = {
|
||||
var selectedNode = $('sitetree').firstSelected();
|
||||
if(selectedNode) this.showApplicableChildrenPageTypes(selectedNode.hints);
|
||||
}
|
||||
$('sitetree').observeMethod('SelectionChanged', this.treeSelectionChanged.bind(this));
|
||||
},
|
||||
|
||||
onclick : function() {
|
||||
@ -46,9 +47,6 @@ addpageclass.prototype = {
|
||||
if( selectedNode.hints && selectedNode.hints.defaultChild )
|
||||
$(_HANDLER_FORMS.addpage).elements.PageType.value = selectedNode.hints.defaultChild;
|
||||
}
|
||||
|
||||
this.o1 = $('sitetree').observeMethod('SelectionChanged', this.treeSelectionChanged.bind(this));
|
||||
this.o2 = $(_HANDLER_FORMS[this.id]).observeMethod('Close', this.popupClosed.bind(this));
|
||||
|
||||
$(_HANDLER_FORMS[this.id]).elements.PageType.onchange = this.typeDropdown_change;
|
||||
}
|
||||
@ -73,7 +71,7 @@ addpageclass.prototype = {
|
||||
this.resetPageTypeOptions();
|
||||
if (typeof hints.allowedChildren != 'undefined') {
|
||||
var select = $(_HANDLER_FORMS.addpage).elements.PageType;
|
||||
|
||||
|
||||
var toRemove = new Array();
|
||||
for(var i = 0; i < select.options.length; i++) {
|
||||
var itemFound = false;
|
||||
@ -91,11 +89,6 @@ addpageclass.prototype = {
|
||||
$(_HANDLER_FORMS.addpage).elements.PageType.value = selectedNode.hints.defaultChild;
|
||||
},
|
||||
|
||||
popupClosed : function() {
|
||||
$('sitetree').stopObserving(this.o1);
|
||||
$(_HANDLER_FORMS.addpage).stopObserving(this.o2);
|
||||
},
|
||||
|
||||
typeDropdown_change : function() {
|
||||
// Don't do anything if we're already on an appropriate node
|
||||
var sel = $('sitetree').firstSelected();
|
||||
|
Loading…
x
Reference in New Issue
Block a user