From c3d622c910ea86e839d23bedaffcb2b5fc2e3f10 Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 29 Aug 2012 20:33:03 +1200 Subject: [PATCH] BUG: Fix an issue caused by moving a page from one location in the tree to another location doesn't update parent id in the edit form immediately (see #7740) The issue causes the moved page to revert to previous location when Save and Publish before any page refresh or page switching. This commit also adds 'Modified' badge to the moved page --- admin/javascript/LeftAndMain.Tree.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/admin/javascript/LeftAndMain.Tree.js b/admin/javascript/LeftAndMain.Tree.js index 101f93fe0..6686e8923 100644 --- a/admin/javascript/LeftAndMain.Tree.js +++ b/admin/javascript/LeftAndMain.Tree.js @@ -86,7 +86,7 @@ .bind('move_node.jstree', function(e, data) { if(self.getIsUpdatingTree()) return; - 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), newParentID = $(newParentNode).data('id') || 0, nodeID = $(movedNode).data('id'); var siblingIDs = $.map($(movedNode).siblings().andSelf(), function(el) { return $(el).data('id'); }); @@ -94,10 +94,14 @@ $.ajax({ 'url': self.data('urlSavetreenode'), 'data': { - ID: $(movedNode).data('id'), - ParentID: $(newParentNode).data('id') || 0, + ID: nodeID, + ParentID: newParentID, SiblingIDs: siblingIDs }, + success: function() { + $('.cms-edit-form :input[name=ParentID]').val(newParentID); + self.updateNodesFromServer([nodeID]); + }, statusCode: { 403: function() { $.jstree.rollback(data.rlbk);