mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Stop MenuTitle updating tree on change
If the MenuTitle is changed and the tree updates, not saving the changes to the page leaves the tree with the new title instead of the old, correct one (until a refresh). This also seems counter-intuitive anyway - suggesting to users that their updated MenuTitle has been saved before it actually has.
This commit is contained in:
parent
26b086c3f7
commit
595a0375e7
@ -130,40 +130,6 @@
|
|||||||
updateURLFromTitle.hide();
|
updateURLFromTitle.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* MenuTitle
|
|
||||||
*/
|
|
||||||
$('.cms-edit-form input[name=MenuTitle]').entwine({
|
|
||||||
onchange: function() {
|
|
||||||
this.updatedRelatedFields();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as the onchange handler but callable as a method
|
|
||||||
*/
|
|
||||||
updatedRelatedFields: function() {
|
|
||||||
var menuTitle = this.val();
|
|
||||||
this.updateTreeLabel(menuTitle);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function: updatePanelLabels
|
|
||||||
*
|
|
||||||
* Update the tree
|
|
||||||
* (String) title
|
|
||||||
*/
|
|
||||||
updateTreeLabel: function(title) {
|
|
||||||
var pageID = $('.cms-edit-form input[name=ID]').val();
|
|
||||||
|
|
||||||
// only update immediate text element, we don't want to update all the nested ones
|
|
||||||
var treeItem = $('.item:first', $('.cms-tree').find("[data-id='" + pageID + "']"));
|
|
||||||
if (title && title != "") {
|
|
||||||
treeItem.text(title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class: .cms-edit-form .parentTypeSelector
|
* Class: .cms-edit-form .parentTypeSelector
|
||||||
|
Loading…
Reference in New Issue
Block a user