Skip to content
This repository
Browse code

BUG: Fix an issue caused by moving a page from one location in the tr…

…ee 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
  • Loading branch information...
commit c3d622c910ea86e839d23bedaffcb2b5fc2e3f10 1 parent 70b22fa
Saophalkun Ponlu authored August 29, 2012

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  admin/javascript/LeftAndMain.Tree.js
10  admin/javascript/LeftAndMain.Tree.js
@@ -86,7 +86,7 @@
86 86
 						.bind('move_node.jstree', function(e, data) {
87 87
 							if(self.getIsUpdatingTree()) return;
88 88
 
89  
-							var movedNode = data.rslt.o, newParentNode = data.rslt.np, oldParentNode = data.inst._get_parent(movedNode);
  89
+							var movedNode = data.rslt.o, newParentNode = data.rslt.np, oldParentNode = data.inst._get_parent(movedNode), newParentID = $(newParentNode).data('id') || 0, nodeID = $(movedNode).data('id');
90 90
 							var siblingIDs = $.map($(movedNode).siblings().andSelf(), function(el) {
91 91
 								return $(el).data('id');
92 92
 							});
@@ -94,10 +94,14 @@
94 94
 							$.ajax({
95 95
 								'url': self.data('urlSavetreenode'),
96 96
 								'data': {
97  
-									ID: $(movedNode).data('id'), 
98  
-									ParentID: $(newParentNode).data('id') || 0,
  97
+									ID: nodeID, 
  98
+									ParentID: newParentID,
99 99
 									SiblingIDs: siblingIDs
100 100
 								},
  101
+								success: function() {
  102
+									$('.cms-edit-form :input[name=ParentID]').val(newParentID);
  103
+									self.updateNodesFromServer([nodeID]);
  104
+								},
101 105
 								statusCode: {
102 106
 									403: function() {
103 107
 										$.jstree.rollback(data.rlbk);

0 notes on commit c3d622c

Please sign in to comment.
Something went wrong with that request. Please try again.