Fix the comments "river." issue 9. props garyc40. see #16262
git-svn-id: http://svn.automattic.com/wordpress/trunk@17344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
acd8d41b65
commit
47c8008257
|
@ -32,6 +32,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
parent::WP_List_Table( array(
|
parent::WP_List_Table( array(
|
||||||
'plural' => 'comments',
|
'plural' => 'comments',
|
||||||
'singular' => 'comment',
|
'singular' => 'comment',
|
||||||
|
'ajax' => true,
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +268,7 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
function display() {
|
function display() {
|
||||||
extract( $this->_args );
|
extract( $this->_args );
|
||||||
|
|
||||||
// wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
|
wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
|
||||||
|
|
||||||
$this->display_tablenav( 'top' );
|
$this->display_tablenav( 'top' );
|
||||||
|
|
||||||
|
@ -538,7 +539,7 @@ class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
|
||||||
function display( $output_empty = false ) {
|
function display( $output_empty = false ) {
|
||||||
extract( $this->_args );
|
extract( $this->_args );
|
||||||
|
|
||||||
// wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
|
wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
|
||||||
?>
|
?>
|
||||||
<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0" style="display:none;">
|
<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0" style="display:none;">
|
||||||
<tbody id="the-comment-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
|
<tbody id="the-comment-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
|
||||||
|
|
|
@ -81,7 +81,7 @@ class WP_List_Table {
|
||||||
$args = wp_parse_args( $args, array(
|
$args = wp_parse_args( $args, array(
|
||||||
'plural' => '',
|
'plural' => '',
|
||||||
'singular' => '',
|
'singular' => '',
|
||||||
'ajax' => true
|
'ajax' => false
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$screen = get_current_screen();
|
$screen = get_current_screen();
|
||||||
|
@ -93,10 +93,10 @@ class WP_List_Table {
|
||||||
|
|
||||||
$this->_args = $args;
|
$this->_args = $args;
|
||||||
|
|
||||||
// if ( $args['ajax'] ) {
|
if ( $args['ajax'] ) {
|
||||||
// wp_enqueue_script( 'list-table' );
|
// wp_enqueue_script( 'list-table' );
|
||||||
// add_action( 'admin_footer', array( &$this, '_js_vars' ) );
|
add_action( 'admin_footer', array( &$this, '_js_vars' ) );
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -211,11 +211,15 @@ setCommentsList = function() {
|
||||||
|
|
||||||
theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
|
theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
|
||||||
|
|
||||||
// refillTheExtraList();
|
refillTheExtraList();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* var refillTheExtraList = function(ev) {
|
var refillTheExtraList = function(ev) {
|
||||||
var args = $.query.get(), total_pages = listTable.get_total_pages(), per_page = $('input[name=_per_page]', '#comments-form').val();
|
// var args = $.query.get(), total_pages = listTable.get_total_pages(), per_page = $('input[name=_per_page]', '#comments-form').val(), r;
|
||||||
|
var args = $.query.get(), total_pages = $('.total-pages').text(), per_page = $('input[name=_per_page]', '#comments-form').val(), r;
|
||||||
|
|
||||||
|
if (! args.paged)
|
||||||
|
args.paged = 1;
|
||||||
|
|
||||||
if (args.paged > total_pages) {
|
if (args.paged > total_pages) {
|
||||||
return;
|
return;
|
||||||
|
@ -226,17 +230,29 @@ setCommentsList = function() {
|
||||||
args.number = Math.min(8, per_page); // see WP_Comments_List_Table::prepare_items() @ class-wp-comments-list-table.php
|
args.number = Math.min(8, per_page); // see WP_Comments_List_Table::prepare_items() @ class-wp-comments-list-table.php
|
||||||
} else {
|
} else {
|
||||||
args.number = 1;
|
args.number = 1;
|
||||||
args.offset = per_page - 1; // fetch only the last item of the next page
|
args.offset = Math.min(8, per_page) - 1; // fetch only the next item on the extra list
|
||||||
}
|
}
|
||||||
|
|
||||||
args.no_placeholder = true;
|
args.no_placeholder = true;
|
||||||
|
|
||||||
args.paged ++;
|
args.paged ++;
|
||||||
|
|
||||||
listTable.fetch_list(args, function(response) {
|
args = $.extend(args, {
|
||||||
theExtraList.get(0).wpList.add( response.rows );
|
'action': 'fetch-list',
|
||||||
|
'list_args': list_args,
|
||||||
|
'_ajax_fetch_list_nonce': $('#_ajax_fetch_list_nonce').val()
|
||||||
});
|
});
|
||||||
}; */
|
|
||||||
|
$.ajax({
|
||||||
|
url: ajaxurl,
|
||||||
|
global: false,
|
||||||
|
dataType: 'json',
|
||||||
|
data: args,
|
||||||
|
success: function(response) {
|
||||||
|
theExtraList.get(0).wpList.add( response.rows );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
|
||||||
theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )
|
theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -299,7 +299,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
|
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20090106' );
|
||||||
$scripts->add_data( 'admin-custom-fields', 'group', 1 );
|
$scripts->add_data( 'admin-custom-fields', 'group', 1 );
|
||||||
|
|
||||||
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20110121' );
|
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110121b' );
|
||||||
$scripts->add_data( 'admin-comments', 'group', 1 );
|
$scripts->add_data( 'admin-comments', 'group', 1 );
|
||||||
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
|
||||||
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
||||||
|
|
Loading…
Reference in New Issue