mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Supressed dependencies of tree logic on SiteTree elements (not properly isolated to work well with Folder objects)
This commit is contained in:
parent
b1d95cffac
commit
ce3d48e310
@ -663,7 +663,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
$titleFn = function(&$child) use(&$controller, &$recordController) {
|
$titleFn = function(&$child) use(&$controller, &$recordController) {
|
||||||
$classes = $child->CMSTreeClasses();
|
$classes = $child->CMSTreeClasses();
|
||||||
if($controller->isCurrentPage($child)) $classes .= " current";
|
if($controller->isCurrentPage($child)) $classes .= " current";
|
||||||
$flags = $child->getStatusFlags();
|
$flags = $child->hasMethod('getStatusFlags') ? $child->getStatusFlags() : false;
|
||||||
if($flags) $classes .= ' ' . implode(' ', array_keys($flags));
|
if($flags) $classes .= ' ' . implode(' ', array_keys($flags));
|
||||||
return "<li id=\"record-$child->ID\" data-id=\"$child->ID\" data-pagetype=\"$child->ClassName\" class=\"" . $classes . "\">" .
|
return "<li id=\"record-$child->ID\" data-id=\"$child->ID\" data-pagetype=\"$child->ClassName\" class=\"" . $classes . "\">" .
|
||||||
"<ins class=\"jstree-icon\"> </ins>" .
|
"<ins class=\"jstree-icon\"> </ins>" .
|
||||||
|
@ -134,7 +134,7 @@
|
|||||||
hints = self.getHints(),
|
hints = self.getHints(),
|
||||||
disallowedChildren = [],
|
disallowedChildren = [],
|
||||||
hintKey = newParentClass ? newParentClass : 'Root',
|
hintKey = newParentClass ? newParentClass : 'Root',
|
||||||
hint = (typeof hints[hintKey] != 'undefined') ? hints[hintKey] : null;
|
hint = (hints && typeof hints[hintKey] != 'undefined') ? hints[hintKey] : null;
|
||||||
|
|
||||||
// Special case for VirtualPage: Check that original page type is an allowed child
|
// Special case for VirtualPage: Check that original page type is an allowed child
|
||||||
if(hint && movedNode.attr('class').match(/VirtualPage-([^\s]*)/)) movedNodeClass = RegExp.$1;
|
if(hint && movedNode.attr('class').match(/VirtualPage-([^\s]*)/)) movedNodeClass = RegExp.$1;
|
||||||
@ -211,7 +211,8 @@
|
|||||||
updateFromEditForm: function(origData) {
|
updateFromEditForm: function(origData) {
|
||||||
var self = this,
|
var self = this,
|
||||||
form = $('.cms-edit-form').get(0),
|
form = $('.cms-edit-form').get(0),
|
||||||
id = form ? $(form.ID).val() : null;
|
id = form ? $(form.ID).val() : null,
|
||||||
|
urlEditPage = this.data('urlEditpage');
|
||||||
|
|
||||||
// check if a form with a valid ID exists
|
// check if a form with a valid ID exists
|
||||||
if(id) {
|
if(id) {
|
||||||
@ -234,7 +235,7 @@
|
|||||||
node.addClass(statusFlags.join(' '));
|
node.addClass(statusFlags.join(' '));
|
||||||
|
|
||||||
// check if node exists, might have been created instead
|
// check if node exists, might have been created instead
|
||||||
if(!node.length) {
|
if(!node.length && urlEditPage) {
|
||||||
this.jstree(
|
this.jstree(
|
||||||
'create_node',
|
'create_node',
|
||||||
parentNode,
|
parentNode,
|
||||||
@ -251,7 +252,7 @@
|
|||||||
var newNode = self.find('li[data-id='+id+']');
|
var newNode = self.find('li[data-id='+id+']');
|
||||||
// TODO Fix replacement of jstree-icon inside <a> tag
|
// TODO Fix replacement of jstree-icon inside <a> tag
|
||||||
newNode.find('a:first').html(title).attr('href', ss.i18n.sprintf(
|
newNode.find('a:first').html(title).attr('href', ss.i18n.sprintf(
|
||||||
self.data('urlEditpage'), id
|
urlEditPage, id
|
||||||
));
|
));
|
||||||
self.jstree('deselect_all');
|
self.jstree('deselect_all');
|
||||||
self.jstree('select_node', newNode);
|
self.jstree('select_node', newNode);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user