mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Use unobtrusive JS for Comment list table row actions.
Props aubreypwd. Fixes #27533. Built from https://develop.svn.wordpress.org/trunk@28810 git-svn-id: http://core.svn.wordpress.org/trunk@28618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8b272f4379
commit
396e77b643
@ -460,8 +460,12 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||
|
||||
if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
|
||||
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
|
||||
$actions['quickedit'] = '<a onclick="window.commentReply && commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick Edit' ) . '</a>';
|
||||
$actions['reply'] = '<a onclick="window.commentReply && commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>';
|
||||
|
||||
$format = '<a data-comment-id="%d" data-post-id="%d" class="%s" title="%s" href="#">%s</a>';
|
||||
|
||||
$actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'vim-q edit-comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
|
||||
|
||||
$actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'vim-r reply-comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-admin/includes/dashboard.php */
|
||||
|
@ -607,6 +607,25 @@ $(document).ready(function(){
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if ( typeof commentReply != 'undefined' ) {
|
||||
|
||||
// Each "Quick Edit" link, open the comment editor
|
||||
$( 'body' ).on( 'click', '.comment .row-actions .quickedit .edit-comment-inline', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $el = $( e.currentTarget );
|
||||
commentReply.open( $el.data( 'comment-id' ), $el.data( 'post-id' ), 'edit' );
|
||||
} );
|
||||
|
||||
// Each "Reply" link, open the comment reply
|
||||
$( 'body' ).on( 'click', '.comment .row-actions .reply .reply-comment-inline', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $el = $( e.currentTarget );
|
||||
commentReply.open( $el.data('comment-id'), $el.data('post-id') );
|
||||
} );
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
2
wp-admin/js/edit-comments.min.js
vendored
2
wp-admin/js/edit-comments.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user