mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Moved edit-form specific jstree logic to LeftAndMain.EditForm.js
This commit is contained in:
parent
ecddf5b945
commit
51c02289da
@ -40,6 +40,27 @@
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this._setupChangeTracker();
|
this._setupChangeTracker();
|
||||||
|
|
||||||
|
$('.cms-tree').bind('select_node.jstree', function(e, data) {
|
||||||
|
var node = data.rslt.obj, loadedNodeID = self.find(':input[name=ID]').val()
|
||||||
|
|
||||||
|
// Don't allow checking disabled nodes
|
||||||
|
if($(node).hasClass('disabled')) return false;
|
||||||
|
|
||||||
|
// Don't allow reloading of currently selected node,
|
||||||
|
// mainly to avoid doing an ajax request on initial page load
|
||||||
|
if($(node).data('id') == loadedNodeID) return;
|
||||||
|
|
||||||
|
var url = $(node).find('a:first').attr('href');
|
||||||
|
if(url && url != '#') {
|
||||||
|
var xmlhttp = self.loadForm(
|
||||||
|
url,
|
||||||
|
function(response) {}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
self.removeForm();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Can't bind this through jQuery
|
// Can't bind this through jQuery
|
||||||
window.onbeforeunload = function(e) {return self._checkChangeTracker(false);};
|
window.onbeforeunload = function(e) {return self._checkChangeTracker(false);};
|
||||||
|
@ -124,27 +124,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// TODO Move to EditForm logic
|
|
||||||
.bind('select_node.jstree', function(e, data) {
|
|
||||||
var node = data.rslt.obj, loadedNodeID = $('.edit-form :input[name=ID]').val()
|
|
||||||
|
|
||||||
// Don't allow checking disabled nodes
|
|
||||||
if($(node).hasClass('disabled')) return false;
|
|
||||||
|
|
||||||
// Don't allow reloading of currently selected node,
|
|
||||||
// mainly to avoid doing an ajax request on initial page load
|
|
||||||
if($(node).data('id') == loadedNodeID) return;
|
|
||||||
|
|
||||||
var url = $(node).find('a:first').attr('href');
|
|
||||||
if(url && url != '#') {
|
|
||||||
var xmlhttp = $('.edit-form').loadForm(
|
|
||||||
url,
|
|
||||||
function(response) {}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$('.edit-form').removeForm();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.bind('move_node.jstree', function(e, data) {
|
.bind('move_node.jstree', function(e, data) {
|
||||||
var movedNode = data.rslt.o, newParentNode = data.rslt.np, oldParentNode = data.inst._get_parent(movedNode);
|
var movedNode = data.rslt.o, newParentNode = data.rslt.np, oldParentNode = data.inst._get_parent(movedNode);
|
||||||
var siblingIDs = $.map($(movedNode).siblings().andSelf(), function(el) {
|
var siblingIDs = $.map($(movedNode).siblings().andSelf(), function(el) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user