Make WordPress Core

Changeset 31982


Ignore:
Timestamp:
04/02/2015 05:30:13 AM (12 years ago)
Author:
jorbin
Message:

Update aria-label when doing a shiny plugin update

Also updates it again when the shiny plugin update is finished.
Also updates it if the shiny update fails

props mehulkaklotar, afercia
Fixes #31722

Location:
trunk/src
Files:
3 edited

Legend:

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

    r31862 r31982  
    403403                                                if ( $status['url'] ) {
    404404                                                        /* translators: 1: Plugin name and version. */
    405                                                         $action_links[] = '<a class="install-now button" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
     405                                                        $action_links[] = '<a class="install-now button" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Install Now' ) . '</a>';
    406406                                                }
    407407
    … …  
    410410                                                if ( $status['url'] ) {
    411411                                                        /* translators: 1: Plugin name and version */
    412                                                         $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '">' . __( 'Update Now' ) . '</a>';
     412                                                        $action_links[] = '<a class="update-now button" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Update Now' ) . '</a>';
    413413                                                }
    414414
  • trunk/src/wp-admin/js/updates.js

    r31969 r31982  
    3434         * Filesystem credentials to be packaged along with the request.
    3535         *
    36          * @since  4.2.0
     36         * @since 4.2.0
    3737         *
    3838         * @var object
    … …  
    9797        wp.updates.decrementCount = function( upgradeType ) {
    9898                var count,
    99                     pluginCount,
    100                     $adminBarUpdateCount = $( '#wp-admin-bar-updates .ab-label' ),
    101                     $dashboardNavMenuUpdateCount = $( 'a[href="update-core.php"] .update-plugins' ),
    102                     $pluginsMenuItem = $( '#menu-plugins' );
     99                        pluginCount,
     100                        $adminBarUpdateCount = $( '#wp-admin-bar-updates .ab-label' ),
     101                        $dashboardNavMenuUpdateCount = $( 'a[href="update-core.php"] .update-plugins' ),
     102                        $pluginsMenuItem = $( '#menu-plugins' );
    103103
    104104
    … …  
    146146         */
    147147        wp.updates.updatePlugin = function( plugin, slug ) {
    148                 var $message;
     148                var $message, name;
    149149                if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
    150150                        $message = $( '[data-slug="' + slug + '"]' ).next().find( '.update-message' );
    151151                } else if ( 'plugin-install' === pagenow ) {
    152152                        $message = $( '.plugin-card-' + slug ).find( '.update-now' );
     153                        name = $message.data( 'name' );
     154                        $message.attr( 'aria-label', wp.updates.l10n.updatingLabel.replace( '%s', name ) );
    153155                }
    154156
    … …  
    199201         */
    200202        wp.updates.updateSuccess = function( response ) {
    201                 var $updateMessage;
     203                var $updateMessage, name, $pluginRow, newText;
    202204                if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
    203                         var $pluginRow = $( '[data-slug="' + response.slug + '"]' ).first();
     205                        $pluginRow = $( '[data-slug="' + response.slug + '"]' ).first();
    204206                        $updateMessage = $pluginRow.next().find( '.update-message' );
    205207                        $pluginRow.addClass( 'updated' ).removeClass( 'update' );
    206208
    207209                        // Update the version number in the row.
    208                         var newText = $pluginRow.find('.plugin-version-author-uri').html().replace( response.oldVersion, response.newVersion );
     210                        newText = $pluginRow.find('.plugin-version-author-uri').html().replace( response.oldVersion, response.newVersion );
    209211                        $pluginRow.find('.plugin-version-author-uri').html( newText );
    210212
    … …  
    214216                        $updateMessage = $( '.plugin-card-' + response.slug ).find( '.update-now' );
    215217                        $updateMessage.addClass( 'button-disabled' );
     218                        name = $updateMessage.data( 'name' );
     219                        $updateMessage.attr( 'aria-label', wp.updates.l10n.updatedLabel.replace( '%s', name ) );
    216220                }
    217221
    … …  
    241245         */
    242246        wp.updates.updateError = function( response ) {
    243                 var $message;
     247                var $message, name;
    244248                wp.updates.updateDoneSuccessfully = false;
    245249                if ( response.errorCode && response.errorCode == 'unable_to_connect_to_filesystem' ) {
    … …  
    251255                } else if ( 'plugin-install' === pagenow ) {
    252256                        $message = $( '.plugin-card-' + response.slug ).find( '.update-now' );
     257
     258                        name = $message.data( 'name' );
     259                        $message.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', name ) );
    253260                }
    254261                $message.removeClass( 'updating-message' );
  • trunk/src/wp-includes/script-loader.php

    r31973 r31982  
    526526                        'ajax_nonce' => wp_create_nonce( 'updates' ),
    527527                        'l10n'       => array(
    528                                 'updating'      => __( 'Updating...' ),
    529                                 'updated'       => __( 'Updated!' ),
    530                                 'updateFailed'  => __( 'Update failed.' ),
    531                                 'updatingMsg'   => __( 'Updating... please wait.' ),
    532                                 'updatedMsg'    => __( 'Update completed successfully.' ),
    533                                 'updateCancel'  => __( 'Update canceled' ),
     528                                'updating'          => __( 'Updating...' ),
     529                                'updated'           => __( 'Updated!' ),
     530                                'updateFailed'      => __( 'Update Failed' ),
     531                                /* translators: Plugin Name */
     532                                'updatingLabel'     => __( 'Updating %s...' ),
     533                                /* translators: Plugin Name */
     534                                'updatedLabel'      => __( '%s updated!' ),
     535                                /* translators: Plugin Name */
     536                                'updateFailedLabel' => __( '%s update failed' ),
     537                                'updatingMsg'       => __( 'Updating... please wait.' ),
     538                                'updatedMsg'        => __( 'Update completed successfully.' ),
     539                                'updateCancel'      => __( 'Update canceled.' ),
    534540                        )
    535541                ) );
Note: See TracChangeset for help on using the changeset viewer.