mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUGFIX Changed TreeNodeAPI->setNodeIcon() javascript to not require the old classname to replace. All PHP classnames stored in CSS class strings now have the prefix 'class-' which makes them easy to detect without context
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92668 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a9c257bc2f
commit
fef02e8b1e
@ -133,9 +133,9 @@ TreeAPI.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setNodeIcon: function(idx, oldClassName, newClassName) {
|
setNodeIcon: function(idx, newClassName) {
|
||||||
this.performOnTreeNode(idx, function(treeNode) {
|
this.performOnTreeNode(idx, function(treeNode) {
|
||||||
treeNode.className = treeNode.className.replace(oldClassName,newClassName);
|
treeNode.className = treeNode.className.replace(/(class-)[^\s]*/,'$1' + newClassName);
|
||||||
treeNode.aSpan.className = 'a ' + treeNode.className.replace('closed','spanClosed');
|
treeNode.aSpan.className = 'a ' + treeNode.className.replace('closed','spanClosed');
|
||||||
var aTag = treeNode.getElementsByTagName('a')[0];
|
var aTag = treeNode.getElementsByTagName('a')[0];
|
||||||
aTag.title = 'Page type: ' + newClassName;
|
aTag.title = 'Page type: ' + newClassName;
|
||||||
@ -149,7 +149,11 @@ TreeAPI.prototype = {
|
|||||||
setNodeParentID: function (idx, parentID) {
|
setNodeParentID: function (idx, parentID) {
|
||||||
var treeNode = this.getTreeNodeByIdx(idx);
|
var treeNode = this.getTreeNodeByIdx(idx);
|
||||||
var parentNode = this.getTreeNodeByIdx(parentID);
|
var parentNode = this.getTreeNodeByIdx(parentID);
|
||||||
parentNode.appendTreeNode(treeNode);
|
var currentParentNode = jQuery(treeNode).parents('li')[0];
|
||||||
|
// Only change parent node if its different than the current,
|
||||||
|
// otherwise we affect the sort order unnecessarily due to
|
||||||
|
// appendTreeNode() not looking at existing sorts
|
||||||
|
if(!currentParentNode || parentNode != currentParentNode) parentNode.appendTreeNode(treeNode);
|
||||||
},
|
},
|
||||||
|
|
||||||
setCurrentByIdx : function(idx) {
|
setCurrentByIdx : function(idx) {
|
||||||
|
Loading…
Reference in New Issue
Block a user