@@ -74,7 +74,7 @@ var AdminTree = (function () {
74
74
"initially_load" : config . path . expanded ,
75
75
"initially_open" : config . path . preloaded
76
76
} ,
77
- "plugins" : [ "contextmenu" , "themes" , "types" , "ui" , "json_data" , "dnd " , "crrm " , "cookies" ] ,
77
+ "plugins" : [ "contextmenu" , "themes" , "types" , "ui" , "json_data" , "crrm " , "dnd " , "cookies" ] ,
78
78
"json_data" : {
79
79
"ajax" : {
80
80
"url" : config . ajax . children_url ,
@@ -90,7 +90,7 @@ var AdminTree = (function () {
90
90
"types" : {
91
91
"max_depth" : - 1 ,
92
92
"max_children" : - 1 ,
93
- "valid_children" : [ "all" ] ,
93
+ "valid_children" : "all" ,
94
94
"types" : config . types
95
95
} ,
96
96
"ui" : {
@@ -195,10 +195,16 @@ var AdminTree = (function () {
195
195
var oldParent = data . rslt . op ;
196
196
var newParent = data . rslt . np ;
197
197
198
+ // parent could be the tree
199
+ var parent = newParent . attr ( "id" ) ;
200
+ if ( treeInst . is ( newParent ) ) {
201
+ parent = config . rootNode ;
202
+ }
203
+
198
204
if ( ! oldParent . is ( newParent ) ) {
199
205
$ . post (
200
206
config . ajax . move_url ,
201
- { "dropped" : dropped . attr ( "id" ) , "target" : newParent . attr ( "id" ) } ,
207
+ { "dropped" : dropped . attr ( "id" ) , "target" : parent } ,
202
208
function ( data ) {
203
209
dropped . attr ( "id" , data . id ) ;
204
210
dropped . attr ( "url_safe_id" , data . url_safe_id ) ;
@@ -207,7 +213,7 @@ var AdminTree = (function () {
207
213
} else {
208
214
$ . post (
209
215
config . ajax . reorder_url ,
210
- { "dropped" : dropped . attr ( "id" ) , "target" : target . attr ( "id" ) , "parent" : newParent . attr ( "id" ) , "position" : position }
216
+ { "dropped" : dropped . attr ( "id" ) , "target" : target . attr ( "id" ) , "parent" : parent , "position" : position }
211
217
) ;
212
218
}
213
219
} )
0 commit comments