Make WordPress Core

Changeset 25663


Ignore:
Timestamp:
10/02/2013 08:37:48 PM (13 years ago)
Author:
wonderboymusic
Message:

When Quick Edit'ing a page, checks if edited page has a new parent and moves the row underneath that one. If the parent doesn't exist on this page then it hides the row altogether.

Props solarissmoke, MikeHansenMe.
Fixes #14188.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/inline-edit-post.js

    r25595 r25663  
    224224
    225225        save : function(id) {
    226                 var params, fields, page = $('.post_status_page').val() || '';
     226                var params, fields, parent_ID, page = $('.post_status_page').val() || '';
    227227
    228228                if ( typeof(id) == 'object' )
    … …  
    241241                fields = $('#edit-'+id+' :input').serialize();
    242242                params = fields + '&' + $.param(params);
     243               
     244                // parent ID for repositioning pages if their parent is modified
     245                parent_ID = $('#post_parent').val() || 0;
    243246
    244247                // make ajax request
    … …  
    251254                                                $(inlineEditPost.what+id).remove();
    252255                                                $('#edit-'+id).before(r).remove();
     256                                                if( parent_ID ){
     257                                                        if( $(inlineEditPost.what + parent_ID).length == 0 )    // parent does not exist on this page
     258                                                                return;
     259
     260                                                        $(inlineEditPost.what + parent_ID).after( $(inlineEditPost.what + id) );
     261                                                        // redo alternates
     262                                                        $('#the-list>tr:odd').addClass("alternate");
     263                                                        $('#the-list>tr:even').removeClass("alternate");
     264                                                }
    253265                                                $(inlineEditPost.what+id).hide().fadeIn();
    254266                                        } else {
Note: See TracChangeset for help on using the changeset viewer.