Make WordPress Core

Ticket #37563: 37563.5.diff

File 37563.5.diff, 4.9 KB (added by swissspidy, 9 years ago)
  • src/wp-admin/js/updates.js

    diff --git src/wp-admin/js/updates.js src/wp-admin/js/updates.js
    index cc5090c..09f3eaf 100644
     
    523523                        $message = $( '[data-slug="' + args.slug + '"]' );
    524524                }
    525525
    526                 $message.text( wp.updates.l10n.installing );
     526                if ( $message.html() !== wp.updates.l10n.installing ) {
     527                        $message.data( 'originaltext', $message.html() );
     528                }
    527529
    528530                $message
    529531                        .addClass( 'updating-message' )
    530                         .attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $message.data( 'name' ) ) );
     532                        .attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $message.data( 'name' ) ) )
     533                        .text( wp.updates.l10n.installing );
    531534
    532535                wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' );
    533536
     
    17091712                        } else if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
    17101713                                $message = $( 'tr[data-plugin="' + job.data.plugin + '"]' ).find( '.update-message' );
    17111714                        } else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
    1712                                 $message = $( '.update-now.updating-message' );
     1715                                $message = $( '.updating-message' );
    17131716                        } else {
    17141717                                $message = $updatingMessage;
    17151718                        }
    17161719
    1717                         if ( $message ) {
     1720                        if ( $message && $message.hasClass( 'updating-message' ) ) {
    17181721                                originalText = $message.data( 'originaltext' );
    17191722
    17201723                                if ( 'undefined' === typeof originalText ) {
     
    17241727                                $message
    17251728                                        .removeClass( 'updating-message' )
    17261729                                        .html( originalText );
     1730
     1731                                if ( 'update-plugin' === job.action ) {
     1732                                        $message.attr( 'aria-label', wp.updates.l10n.updateNowLabel.replace( '%s', $message.data( 'name' ) ) );
     1733                                } else if ( 'install-plugin' === job.action ) {
     1734                                        $message.attr( 'aria-label', wp.updates.l10n.installNowLabel.replace( '%s', $message.data( 'name' ) ) );
     1735                                }
    17271736                        }
    17281737
    17291738                        wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
     
    19992008
    20002009                        // Find all the checkboxes which have been checked.
    20012010                        itemsSelected.each( function( index, element ) {
    2002                                 var $checkbox  = $( element ),
     2011                                var $checkbox = $( element ),
    20032012                                        $itemRow = $checkbox.parents( 'tr' );
    20042013
    2005                                 // Un-check the box.
    2006                                 $checkbox.prop( 'checked', false );
    2007 
    20082014                                // Only add update-able items to the update queue.
    20092015                                if ( 'update-selected' === bulkAction && ( ! $itemRow.hasClass( 'update' ) || $itemRow.find( 'notice-error' ).length ) ) {
     2016
     2017                                        // Un-check the box.
     2018                                        $checkbox.prop( 'checked', false );
    20102019                                        return;
    20112020                                }
    20122021
     
    20222031
    20232032                        // Display bulk notification for updates of any kind.
    20242033                        $document.on( 'wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error', function( event, response ) {
    2025                                 var $bulkActionNotice, itemName;
     2034                                var $itemRow = $( '[data-slug="' + response.slug + '"]' ),
     2035                                        $bulkActionNotice, itemName;
    20262036
    20272037                                if ( 'wp-' + response.update + '-update-success' === event.type ) {
    20282038                                        success++;
    20292039                                } else {
    2030                                         itemName = response.pluginName ? response.pluginName : $( '[data-slug="' + response.slug + '"]' ).find( '.theme-title strong' ).text();
     2040                                        itemName = response.pluginName ? response.pluginName : $itemRow.find( '.theme-title strong' ).text();
    20312041
    20322042                                        error++;
    20332043                                        errorMessages.push( itemName + ': ' + response.errorMessage );
    20342044                                }
    20352045
     2046                                $itemRow.find( 'input[name="checked[]"]:checked' ).prop( 'checked', false );
     2047
    20362048                                wp.updates.adminNotice = wp.template( 'wp-bulk-updates-admin-notice' );
    20372049
    20382050                                wp.updates.addAdminNotice( {
  • src/wp-includes/script-loader.php

    diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
    index 3a1ec18..b0d3a15 100644
    function wp_default_scripts( &$scripts ) { 
    616616                                'updated'                    => __( 'Updated!' ),
    617617                                'update'                     => __( 'Update' ),
    618618                                'updateNow'                  => __( 'Update Now' ),
     619                                /* translators: %s: Plugin name and version */
     620                                'updateNowLabel'             => __( 'Update %s now' ),
    619621                                'updateFailedShort'          => __( 'Update Failed!' ),
    620622                                /* translators: %s: Error string for a failed update */
    621623                                'updateFailed'               => __( 'Update Failed: %s' ),
  • tests/qunit/fixtures/updates.js

    diff --git tests/qunit/fixtures/updates.js tests/qunit/fixtures/updates.js
    index 013536c..a01ba72 100644
    window._wpUpdatesSettings = { 
    99                'updated': 'Updated!',
    1010                'update': 'Update',
    1111                'updateNow': 'Update Now',
     12                'updateNowLabel': 'Update Now',
    1213                'updateFailedShort': 'Update Failed!',
    1314                'updateFailed': 'Update Failed: %s',
    1415                'updatingLabel': 'Updating %s...',
    window._wpUpdatesSettings = { 
    1920                'updateCancel': 'Update canceled.',
    2021                'beforeunload': 'Updates may not complete if you navigate away from this page.',
    2122                'installNow': 'Install Now',
     23                'installNowLabel': 'Update %s now',
    2224                'installing': 'Installing...',
    2325                'installed': 'Installed!',
    2426                'installFailedShort': 'Install Failed!',