Update comment count in single post row on post comment screen, edit.php?p=1&c=1.

git-svn-id: http://svn.automattic.com/wordpress/trunk@6550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2008-01-04 11:53:15 +00:00
parent 2ad5f03b1c
commit f05fe26e0c
2 changed files with 9 additions and 3 deletions

View File

@ -66,7 +66,7 @@ foreach($posts_columns as $column_name=>$column_display_name) {
$pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
if ( $left ) if ( $left )
echo '<strong>'; echo '<strong>';
comments_number("<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('0') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase'>" . __('%') . '</a>'); comments_number("<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase' class='post-com-count'>" . __('0') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase' class='post-com-count'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1' title='$pending_phrase' class='post-com-count'>" . __('%') . '</a>');
if ( $left ) if ( $left )
echo '</strong>'; echo '</strong>';
?> ?>

View File

@ -3,15 +3,21 @@ jQuery(function($) {
var dimAfter = function( r, settings ) { var dimAfter = function( r, settings ) {
$('.comment-count').each( function() { $('.comment-count').each( function() {
var a = $('#' + this.id ); var a = $(this);
var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ); var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
a.html( n.toString() ); a.html( n.toString() );
}); });
// we need to do the opposite for this guy, TODO: update title
$('.post-com-count').each( function() {
var a = $(this);
var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? -1 : 1 );
a.html( n.toString() );
});
} }
var delAfter = function( r, settings ) { var delAfter = function( r, settings ) {
$('.comment-count').each( function() { $('.comment-count').each( function() {
var a = $('#' + this.id ); var a = $(this);
if ( a.parent('.current').size() || $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) { if ( a.parent('.current').size() || $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) {
var n = parseInt(a.html(),10) - 1; var n = parseInt(a.html(),10) - 1;
a.html( n.toString() ); a.html( n.toString() );