Permalink
Browse files

MINOR Moved edit-form specific jstree logic to LeftAndMain.EditForm.js

  • Loading branch information...
1 parent ecddf5b commit 51c02289da178dbeb1c61cf95e1dc60f2dc3f247 @chillu chillu committed Apr 20, 2011
Showing with 21 additions and 21 deletions.
  1. +21 −0 admin/javascript/LeftAndMain.EditForm.js
  2. +0 −21 admin/javascript/LeftAndMain.Tree.js
@@ -40,6 +40,27 @@
var self = this;
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
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) {
var movedNode = data.rslt.o, newParentNode = data.rslt.np, oldParentNode = data.inst._get_parent(movedNode);
var siblingIDs = $.map($(movedNode).siblings().andSelf(), function(el) {

0 comments on commit 51c0228

Please sign in to comment.