Make WordPress Core

Ticket #38185: 38185.2.patch

File 38185.2.patch, 4.2 KB (added by mariovalney, 8 years ago)
  • wp-admin/css/list-tables.css

    diff --git a/wp-admin/css/list-tables.css b/wp-admin/css/list-tables.css
    index 67ef22e..b4139e8 100644
    a b th.asc a:focus span.sorting-indicator:before { 
    549549        content: "\f142";
    550550}
    551551
     552tr .locked-indicator {
     553        display: none;
     554}
     555
    552556tr.wp-locked .locked-indicator {
    553557        margin-left: 6px;
    554558        height: 20px;
    555559        width: 16px;
     560        display: block;
    556561}
    557562
    558563tr.wp-locked .locked-indicator:before {
  • wp-admin/edit.php

    diff --git a/wp-admin/edit.php b/wp-admin/edit.php
    index 120140a..28ed53e 100644
    a b if ( $doaction ) { 
    190190
    191191$wp_list_table->prepare_items();
    192192
     193
    193194wp_enqueue_script('inline-edit-post');
    194195wp_enqueue_script('heartbeat');
     196wp_localize_script( 'inline-edit-post', '_wpInlineEditPostStrings', array(
     197        'last_separator'        => __( 'and' ),
     198        'was_unlocked'          => __( 'is not being edited anymore' ),
     199        'were_unlocked'         => __( 'are not being edited anymore' ),
     200        'was_locked'            => __( 'is being edited' ),
     201        'were_locked'           => __( 'are being edited' ),
     202) );
    195203
    196204$title = $post_type_object->labels->name;
    197205
  • wp-admin/includes/class-wp-posts-list-table.php

    diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php
    index 506dded..cd62ef8 100644
    a b class WP_Posts_List_Table extends WP_List_Table { 
    829829                                printf( __( 'Select %s' ), _draft_or_post_title() );
    830830                        ?></label>
    831831                        <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
    832                         <div class="locked-indicator"></div>
     832                        <div class="locked-indicator">
     833                                <span class="screen-reader-text"><?php
     834                                        printf( __( '%s is currently being edited' ), _draft_or_post_title() );
     835                                ?></span>
     836                        </div>
    833837                <?php endif;
    834838        }
    835839
  • wp-admin/js/inline-edit-post.js

    diff --git a/wp-admin/js/inline-edit-post.js b/wp-admin/js/inline-edit-post.js
    index 3a65805..47628f7 100644
    a b $( document ).ready( function(){ inlineEditPost.init(); } ); 
    330330
    331331// Show/hide locks on posts
    332332$( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
    333         var locked = data['wp-check-locked-posts'] || {};
     333        var locked = data['wp-check-locked-posts'] || {}, unlocked_announcements = [], locked_announcements = [];
    334334
    335335        $('#the-list tr').each( function(i, el) {
    336                 var key = el.id, row = $(el), lock_data, avatar;
     336                var key = el.id, row = $(el), lock_data, avatar, title;
    337337
    338338                if ( locked.hasOwnProperty( key ) ) {
    339339                        if ( ! row.hasClass('wp-locked') ) {
    $( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) { 
    346346                                        row.find('.column-title .locked-avatar').empty().append( avatar );
    347347                                }
    348348                                row.addClass('wp-locked');
     349
     350                                // Add announcement
     351                                title = row.find('.column-title .row-title').text();
     352                                locked_announcements.push( title );
    349353                        }
    350354                } else if ( row.hasClass('wp-locked') ) {
    351355                        // Make room for the CSS animation
    352356                        row.removeClass('wp-locked').delay(1000).find('.locked-info span').empty();
     357
     358                        // Add announcement
     359                        title = row.find('.column-title .row-title').text();
     360                        unlocked_announcements.push( title );
    353361                }
    354362        });
     363
     364        // Make announcements
     365        if ( locked_announcements.length > 1 ) {
     366                locked_announcements = locked_announcements.slice(0, -1).join(', ') + ' ' + _wpInlineEditPostStrings.last_separator + ' ' + locked_announcements.slice(-1);
     367                wp.a11y.speak( locked_announcements + " " + _wpInlineEditPostStrings.were_locked );
     368        } else if ( locked_announcements.length == 1 ) {
     369                wp.a11y.speak( locked_announcements + " " + _wpInlineEditPostStrings.was_locked );
     370        }
     371
     372        if ( unlocked_announcements.length > 1 ) {
     373                unlocked_announcements = unlocked_announcements.slice(0, -1).join(', ') + ' ' + _wpInlineEditPostStrings.last_separator + ' ' + unlocked_announcements.slice(-1);
     374                wp.a11y.speak( unlocked_announcements + " " + _wpInlineEditPostStrings.were_unlocked );
     375        } else if ( unlocked_announcements.length == 1 ) {
     376                wp.a11y.speak( unlocked_announcements + " " + _wpInlineEditPostStrings.was_unlocked );
     377        }
     378
    355379}).on( 'heartbeat-send.wp-check-locked-posts', function( e, data ) {
    356380        var check = [];
    357381