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.



git-svn-id: https://develop.svn.wordpress.org/trunk@25663 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2013-10-02 20:37:48 +00:00
parent a27234c898
commit 415a348999
1 changed files with 13 additions and 1 deletions

View File

@ -223,7 +223,7 @@ inlineEditPost = {
},
save : function(id) {
var params, fields, page = $('.post_status_page').val() || '';
var params, fields, parent_ID, page = $('.post_status_page').val() || '';
if ( typeof(id) == 'object' )
id = this.getId(id);
@ -240,6 +240,9 @@ inlineEditPost = {
fields = $('#edit-'+id+' :input').serialize();
params = fields + '&' + $.param(params);
// parent ID for repositioning pages if their parent is modified
parent_ID = $('#post_parent').val() || 0;
// make ajax request
$.post( ajaxurl, params,
@ -250,6 +253,15 @@ inlineEditPost = {
if ( -1 != r.indexOf('<tr') ) {
$(inlineEditPost.what+id).remove();
$('#edit-'+id).before(r).remove();
if( parent_ID ){
if( $(inlineEditPost.what + parent_ID).length == 0 ) // parent does not exist on this page
return;
$(inlineEditPost.what + parent_ID).after( $(inlineEditPost.what + id) );
// redo alternates
$('#the-list>tr:odd').addClass("alternate");
$('#the-list>tr:even').removeClass("alternate");
}
$(inlineEditPost.what+id).hide().fadeIn();
} else {
r = r.replace( /<.[^<>]*?>/g, '' );