Make WordPress Core

Changeset 28810


Ignore:
Timestamp:
06/23/2014 11:54:28 PM (10 years ago)
Author:
wonderboymusic
Message:

Use unobtrusive JS for Comment list table row actions.

Props aubreypwd.
Fixes #27533.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r28629 r28810  
    461461            if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
    462462                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
    463                 $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&nbsp;Edit' ) . '</a>';
    464                 $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>';
     463
     464                $format = '<a data-comment-id="%d" data-post-id="%d" class="%s" title="%s" href="#">%s</a>';
     465
     466                $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'vim-q edit-comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
     467
     468                $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'vim-r reply-comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
    465469            }
    466470
  • trunk/src/wp-admin/js/edit-comments.js

    r27759 r28810  
    608608        );
    609609    }
     610
     611    if ( typeof commentReply != 'undefined' ) {
     612
     613        // Each "Quick Edit" link, open the comment editor
     614        $( 'body' ).on( 'click', '.comment .row-actions .quickedit .edit-comment-inline', function (e) {
     615            e.preventDefault();
     616
     617            var $el = $( e.currentTarget );
     618            commentReply.open( $el.data( 'comment-id' ), $el.data( 'post-id' ), 'edit' );
     619        } );
     620
     621        // Each "Reply" link, open the comment reply
     622        $( 'body' ).on( 'click', '.comment .row-actions .reply .reply-comment-inline', function (e) {
     623            e.preventDefault();
     624
     625            var $el = $( e.currentTarget );
     626            commentReply.open( $el.data('comment-id'), $el.data('post-id') );
     627        } );
     628    }
    610629});
    611630
Note: See TracChangeset for help on using the changeset viewer.