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.


Built from https://develop.svn.wordpress.org/trunk@25663


git-svn-id: http://core.svn.wordpress.org/trunk@25579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2013-10-02 20:38:09 +00:00
parent 6a5d2f8fb0
commit 0793f55437
2 changed files with 14 additions and 2 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);
@ -241,6 +241,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,
function(r) {
@ -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, '' );

File diff suppressed because one or more lines are too long