Dashboard: toggle the "View" link for comments when Approving / Unapproving from the Dashboard widget.

Fixes #35518.


git-svn-id: https://develop.svn.wordpress.org/trunk@37302 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2016-04-22 21:29:19 +00:00
parent 457f5ac6a0
commit e2b9072267
2 changed files with 11 additions and 6 deletions

View File

@ -630,9 +630,7 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
$actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Move this comment to the Trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
}
if ( '1' === $comment->comment_approved ) {
$actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>';
}
$actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>';
/**
* Filter the action links displayed for each comment in the 'Recent Comments'
@ -653,9 +651,13 @@ function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
// Reply and quickedit need a hide-if-no-js span
if ( 'reply' == $action || 'quickedit' == $action )
if ( 'reply' == $action || 'quickedit' == $action ) {
$action .= ' hide-if-no-js';
}
if ( 'view' === $action && '1' !== $comment->comment_approved ) {
$action .= ' hidden';
}
$actions_string .= "<span class='$action'>$sep$link</span>";
}
}

View File

@ -220,12 +220,15 @@ setCommentsList = function() {
if ( settings.data.id == replyID )
replyButton.text(adminCommentsL10n.replyApprove);
c.find('div.comment_status').html('0');
c.find( '.row-actions span.view' ).addClass( 'hidden' ).end()
.find( 'div.comment_status' ).html( '0' );
} else {
if ( settings.data.id == replyID )
replyButton.text(adminCommentsL10n.reply);
c.find('div.comment_status').html('1');
c.find( '.row-actions span.view' ).removeClass( 'hidden' ).end()
.find( 'div.comment_status' ).html( '1' );
}
diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;