Ticket #35350: 35350.diff
File 35350.diff, 5.0 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/plugin-install.php
651 651 break; 652 652 case 'update_available': 653 653 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>'; 655 655 } 656 656 break; 657 657 case 'newer_installed': -
src/wp-admin/js/updates.js
150 150 $card = $( '.plugin-card-' + slug ); 151 151 152 152 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 153 $message = $( '[data- slug="' + slug+ '"]' ).next().find( '.update-message' );153 $message = $( '[data-plugin="' + plugin + '"]' ).next().find( '.update-message' ); 154 154 } else if ( 'plugin-install' === pagenow ) { 155 155 $message = $card.find( '.update-now' ); 156 156 name = $message.data( 'name' ); … … 207 207 wp.updates.updateSuccess = function( response ) { 208 208 var $updateMessage, name, $pluginRow, newText; 209 209 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 210 $pluginRow = $( '[data- slug="' + response.slug+ '"]' ).first();210 $pluginRow = $( '[data-plugin="' + response.plugin + '"]' ).first(); 211 211 $updateMessage = $pluginRow.next().find( '.update-message' ); 212 212 $pluginRow.addClass( 'updated' ).removeClass( 'update' ); 213 213 … … 268 268 error_message = wp.updates.l10n.updateFailed.replace( '%s', response.error ); 269 269 270 270 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' ); 272 272 $message.html( error_message ).removeClass( 'updating-message' ); 273 273 } else if ( 'plugin-install' === pagenow ) { 274 274 $button = $card.find( '.update-now' ); … … 431 431 */ 432 432 wp.updates.requestForCredentialsModalCancel = function() { 433 433 // no updateLock and no updateQueue means we already have cleared things up 434 var slug, $message;434 var data, $message; 435 435 436 436 if( wp.updates.updateLock === false && wp.updates.updateQueue.length === 0 ){ 437 437 return; 438 438 } 439 439 440 slug = wp.updates.updateQueue[0].data.slug,440 data = wp.updates.updateQueue[0].data; 441 441 442 442 // remove the lock, and clear the queue 443 443 wp.updates.updateLock = false; … … 445 445 446 446 wp.updates.requestForCredentialsModalClose(); 447 447 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' ); 449 449 } else if ( 'plugin-install' === pagenow ) { 450 $message = $( '.plugin-card-' + slug ).find( '.update-now' );450 $message = $( '.plugin-card-' + data.slug ).find( '.update-now' ); 451 451 } 452 452 453 453 $message.removeClass( 'updating-message' ); … … 516 516 } 517 517 var updateRow = $( e.target ).parents( '.plugin-update-tr' ); 518 518 // 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' ); 520 520 wp.updates.updatePlugin( updateRow.data( 'plugin' ), updateRow.data( 'slug' ) ); 521 521 } ); 522 522 … … 544 544 545 545 data = { 546 546 'action' : 'updatePlugin', 547 'plugin' : $(this).data('plugin'), 547 548 'slug' : $(this).data('slug') 548 549 }; 549 550 … … 576 577 tb_remove(); 577 578 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 578 579 // 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(); 580 581 // 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' ); 582 583 } else if ( 'plugin-install' === pagenow ) { 583 584 $( '.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' ); 585 586 } 586 587 break; 587 588 }