WordPress.org

Make WordPress Core

Ticket #14188: 14188.diff

File 14188.diff, 1.4 KB (added by solarissmoke, 2 years ago)
  • wp-admin/js/inline-edit-post.dev.js

     
    218218        }, 
    219219 
    220220        save : function(id) { 
    221                 var params, fields, page = $('.post_status_page').val() || ''; 
     221                var params, fields, parent_ID, page = $('.post_status_page').val() || ''; 
    222222 
    223223                if ( typeof(id) == 'object' ) 
    224224                        id = this.getId(id); 
     
    235235 
    236236                fields = $('#edit-'+id+' :input').serialize(); 
    237237                params = fields + '&' + $.param(params); 
     238                 
     239                // parent ID for repositioning pages if their parent is modified 
     240                parent_ID = $('#post_parent').val() || 0; 
    238241 
    239242                // make ajax request 
    240243                $.post('admin-ajax.php', params, 
     
    245248                                        if ( -1 != r.indexOf('<tr') ) { 
    246249                                                $(inlineEditPost.what+id).remove(); 
    247250                                                $('#edit-'+id).before(r).remove(); 
     251                                                if( parent_ID ){ 
     252                                                        if( $(inlineEditPost.what + parent_ID).length == 0 )    // parent does not exist on this page 
     253                                                                return; 
     254 
     255                                                        $(inlineEditPost.what + parent_ID).after( $(inlineEditPost.what + id) ); 
     256                                                        // redo alternates 
     257                                                        $('#the-list>tr:odd').addClass("alternate"); 
     258                                                        $('#the-list>tr:even').removeClass("alternate"); 
     259                                                } 
    248260                                                $(inlineEditPost.what+id).hide().fadeIn(); 
    249261                                        } else { 
    250262                                                r = r.replace( /<.[^<>]*?>/g, '' );