Making WordPress.org

Changeset 7276


Ignore:
Timestamp:
06/06/2018 05:39:51 PM (8 years ago)
Author:
obenland
Message:

Developers: Keep using AJAX for multiple votes

Fixes a regression where the AJAX handler was not working for dynamically added voting links.

Props keesiemeijer.
Fixes #3606.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-voting.php

    r6401 r7276  
    6565                // Only need to enqueue voting-related resources if there are comments to vote on.
    6666                if ( self::user_can_vote() && is_singular() && '0' != get_comments_number() ) {
    67                         wp_register_script( 'wporg-developer-user-notes-voting', get_template_directory_uri() . '/js/user-notes-voting.js', array( 'wp-a11y' ), '20180118', true );
     67                        wp_register_script( 'wporg-developer-user-notes-voting', get_template_directory_uri() . '/js/user-notes-voting.js', array( 'wp-a11y' ), '20180606', true );
    6868                        wp_localize_script( 'wporg-developer-user-notes-voting', 'ajaxurl', admin_url( 'admin-ajax.php' ) );
    6969                        wp_enqueue_script( 'wporg-developer-user-notes-voting' );
     
    307307                }
    308308
    309                 echo '<div id="user-note-voting" class="user-note-voting" data-nonce="' . esc_attr( $nonce ) . '">';
     309                echo '<div class="user-note-voting" data-nonce="' . esc_attr( $nonce ) . '">';
    310310
    311311                // Up vote link
     
    333333                }
    334334                echo '">';
    335                 echo '<span class="dashicons dashicons-arrow-up"></span>';
     335                echo '<span class="dashicons dashicons-arrow-up" aria-hidden="true"></span>';
    336336                echo '<span class="screen-reader-text">' . $title .  '</span>';
    337337                echo "</{$tag}>";
     
    374374                }
    375375                echo '">';
    376                 echo '<span class="dashicons dashicons-arrow-down"></span>';
     376                echo '<span class="dashicons dashicons-arrow-down" aria-hidden="true"></span>';
    377377                echo '<span class="screen-reader-text">' . $title .  '</span>';
    378378                echo "</{$tag}>";
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-voting.js

    r6400 r7276  
    55
    66( function( $, wp ) {
    7         $( '#user-note-voting' ).on( 'click', '.user-note-voting-up, .user-note-voting-down', function( event ) {
     7        $( '#comments' ).on( 'click', 'a.user-note-voting-up, a.user-note-voting-down', function( event ) {
    88                event.preventDefault();
    99
Note: See TracChangeset for help on using the changeset viewer.