@@ -139,20 +139,20 @@ Sitemap.prototype.enableMenuButtons = function() {
139139
140140// @param [Number] node_id
141141// @param [Number] target_node_id
142- // @param [Number] order
143- Sitemap . prototype . move_to = function ( node_id , target_node_id , order ) {
142+ // @param [Number] position A 1 based position for order
143+ Sitemap . prototype . move_to = function ( node_id , target_node_id , position ) {
144144 var path = "/cms/section_nodes/" + node_id + '/move_to_position'
145145 $ . cms_ajax . put ( {
146146 url : path ,
147147 data : {
148148 target_node_id : target_node_id ,
149- position : order
149+ position : position
150150 } ,
151151 success : function ( result ) {
152152 sitemap . clickWebsite ( ) ;
153153 }
154154 } ) ;
155- console . log ( "Dropping node" , node_id , "into" , target_node_id , "at" , order ) ;
155+ console . log ( "Dropping node" , node_id , "into" , target_node_id , "at position " , position ) ;
156156
157157} ;
158158var sitemap = new Sitemap ( ) ;
@@ -174,7 +174,7 @@ $(function() {
174174 stop : function ( event , ui ) {
175175 var parent_section = ui . item . parents ( 'ul:first' ) ;
176176 var moving_node_id = ui . item . children ( 'a:first' ) . data ( 'node-id' ) ;
177- sitemap . move_to ( moving_node_id , parent_section . data ( 'node-id' ) , ui . item . index ( ) ) ;
177+ sitemap . move_to ( moving_node_id , parent_section . data ( 'node-id' ) , ui . item . index ( ) + 1 ) ;
178178 }
179179 } ) ;
180180
0 commit comments