Make WordPress Core

Ticket #35350: 35350.diff

File 35350.diff, 5.0 KB (added by obenland, 9 years ago)
  • src/wp-admin/includes/plugin-install.php

     
    651651                                break;
    652652                        case 'update_available':
    653653                                if ( $status['url'] ) {
    654                                         echo '<a data-slug="' . esc_attr( $api->slug ) . '" id="plugin_update_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) .'</a>';
     654                                        echo '<a data-slug="' . esc_attr( $api->slug ) . '" data-plugin="' . esc_attr( $status['file'] ) . '" id="plugin_update_from_iframe" class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) .'</a>';
    655655                                }
    656656                                break;
    657657                        case 'newer_installed':
  • src/wp-admin/js/updates.js

     
    150150                        $card = $( '.plugin-card-' + slug );
    151151
    152152                if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
    153                         $message = $( '[data-slug="' + slug + '"]' ).next().find( '.update-message' );
     153                        $message = $( '[data-plugin="' + plugin + '"]' ).next().find( '.update-message' );
    154154                } else if ( 'plugin-install' === pagenow ) {
    155155                        $message = $card.find( '.update-now' );
    156156                        name = $message.data( 'name' );
     
    207207        wp.updates.updateSuccess = function( response ) {
    208208                var $updateMessage, name, $pluginRow, newText;
    209209                if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
    210                         $pluginRow = $( '[data-slug="' + response.slug + '"]' ).first();
     210                        $pluginRow = $( '[data-plugin="' + response.plugin + '"]' ).first();
    211211                        $updateMessage = $pluginRow.next().find( '.update-message' );
    212212                        $pluginRow.addClass( 'updated' ).removeClass( 'update' );
    213213
     
    268268                error_message = wp.updates.l10n.updateFailed.replace( '%s', response.error );
    269269
    270270                if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
    271                         $message = $( '[data-slug="' + response.slug + '"]' ).next().find( '.update-message' );
     271                        $message = $( '[data-plugin="' + response.plugin + '"]' ).next().find( '.update-message' );
    272272                        $message.html( error_message ).removeClass( 'updating-message' );
    273273                } else if ( 'plugin-install' === pagenow ) {
    274274                        $button = $card.find( '.update-now' );
     
    431431         */
    432432        wp.updates.requestForCredentialsModalCancel = function() {
    433433                // no updateLock and no updateQueue means we already have cleared things up
    434                 var slug, $message;
     434                var data, $message;
    435435
    436436                if( wp.updates.updateLock === false && wp.updates.updateQueue.length === 0 ){
    437437                        return;
    438438                }
    439439
    440                 slug = wp.updates.updateQueue[0].data.slug,
     440                data = wp.updates.updateQueue[0].data;
    441441
    442442                // remove the lock, and clear the queue
    443443                wp.updates.updateLock = false;
     
    445445
    446446                wp.updates.requestForCredentialsModalClose();
    447447                if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
    448                         $message = $( '[data-slug="' + slug + '"]' ).next().find( '.update-message' );
     448                        $message = $( '[data-plugin="' + data.plugin + '"]' ).next().find( '.update-message' );
    449449                } else if ( 'plugin-install' === pagenow ) {
    450                         $message = $( '.plugin-card-' + slug ).find( '.update-now' );
     450                        $message = $( '.plugin-card-' + data.slug ).find( '.update-now' );
    451451                }
    452452
    453453                $message.removeClass( 'updating-message' );
     
    516516                        }
    517517                        var updateRow = $( e.target ).parents( '.plugin-update-tr' );
    518518                        // Return the user to the input box of the plugin's table row after closing the modal.
    519                         wp.updates.$elToReturnFocusToFromCredentialsModal = $( '#' + updateRow.data( 'slug' ) ).find( '.check-column input' );
     519                        wp.updates.$elToReturnFocusToFromCredentialsModal = updateRow.prev().find( '.check-column input' );
    520520                        wp.updates.updatePlugin( updateRow.data( 'plugin' ), updateRow.data( 'slug' ) );
    521521                } );
    522522
     
    544544
    545545                        data = {
    546546                                'action' : 'updatePlugin',
     547                                'plugin' : $(this).data('plugin'),
    547548                                'slug'   : $(this).data('slug')
    548549                        };
    549550
     
    576577                                tb_remove();
    577578                                if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
    578579                                        // Return the user to the input box of the plugin's table row after closing the modal.
    579                                         $( '#' + message.slug ).find( '.check-column input' ).focus();
     580                                        $( '[data-plugin="' + message.plugin + '"]' ).first().find( '.check-column input' ).focus();
    580581                                        // trigger the update
    581                                         $( '.plugin-update-tr[data-slug="' + message.slug + '"]' ).find( '.update-link' ).trigger( 'click' );
     582                                        $( '.plugin-update-tr[data-plugin="' + message.plugin + '"]' ).find( '.update-link' ).trigger( 'click' );
    582583                                } else if ( 'plugin-install' === pagenow ) {
    583584                                        $( '.plugin-card-' + message.slug ).find( '.column-name a' ).focus();
    584                                         $( '.plugin-card-' + message.slug ).find( '[data-slug="' + message.slug + '"]' ).trigger( 'click' );
     585                                        $( '.plugin-card-' + message.slug ).find( '[data-plugin="' + message.plugin + '"]' ).trigger( 'click' );
    585586                                }
    586587                                break;
    587588                }