Changeset 36221
- Timestamp:
- 01/08/2016 05:47:18 PM (9 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/plugin-install.php
r36092 r36221 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; -
trunk/src/wp-admin/js/updates.js
r35681 r36221 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' ); … … 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' ); … … 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 ) { … … 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 ){ … … 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 … … 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 … … 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 } ); … … 533 533 534 534 $( '#plugin_update_from_iframe' ).on( 'click' , function( e ) { 535 var target, data;535 var target, job; 536 536 537 537 target = window.parent == window ? null : window.parent, … … 543 543 e.preventDefault(); 544 544 545 data = { 546 'action' : 'updatePlugin', 547 'slug' : $(this).data('slug') 545 job = { 546 action: 'updatePlugin', 547 type: 'update-plugin', 548 data: { 549 plugin: $( this ).data( 'plugin' ), 550 slug: $( this ).data( 'slug' ) 551 } 548 552 }; 549 553 550 target.postMessage( JSON.stringify( data), window.location.origin );554 target.postMessage( JSON.stringify( job ), window.location.origin ); 551 555 }); 552 556 … … 575 579 case 'updatePlugin' : 576 580 tb_remove(); 577 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 578 // 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 // trigger the update 581 $( '.plugin-update-tr[data-slug="' + message.slug + '"]' ).find( '.update-link' ).trigger( 'click' ); 582 } else if ( 'plugin-install' === pagenow ) { 583 $( '.plugin-card-' + message.slug ).find( '.column-name a' ).focus(); 584 $( '.plugin-card-' + message.slug ).find( '[data-slug="' + message.slug + '"]' ).trigger( 'click' ); 585 } 581 582 wp.updates.updateQueue.push( message ); 583 wp.updates.queueChecker(); 586 584 break; 587 585 }
Note: See TracChangeset
for help on using the changeset viewer.