Make WordPress Core

Changeset 29662


Ignore:
Timestamp:
09/02/2014 03:56:05 AM (11 years ago)
Author:
helen
Message:

Comments: Simplify JS for inline edit and reply.

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

    r29460 r29662  
    475475                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
    476476
    477                 $format = '<a data-comment-id="%d" data-post-id="%d" class="%s" title="%s" href="#">%s</a>';
    478 
    479                 $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'vim-q edit-comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
    480 
    481                 $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'vim-r reply-comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
     477                $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>';
     478
     479                $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
     480
     481                $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
    482482            }
    483483
  • trunk/src/wp-admin/js/edit-comments.js

    r28810 r29662  
    609609    }
    610610
    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     }
     611    // Quick Edit and Reply have an inline comment editor.
     612    $( '#the-comment-list' ).on( 'click', '.comment-inline', function (e) {
     613        e.preventDefault();
     614        var $el = $( this ),
     615            action = 'replyto';
     616
     617        if ( 'undefined' !== typeof $el.data( 'action' ) ) {
     618            action = $el.data( 'action' );
     619        }
     620
     621        commentReply.open( $el.data( 'commentId' ), $el.data( 'postId' ), action );
     622    } );
    629623});
    630624
Note: See TracChangeset for help on using the changeset viewer.