diff --git a/src/wp-admin/includes/class-bulk-upgrader-skin.php b/src/wp-admin/includes/class-bulk-upgrader-skin.php index 16f410fdc9..60ac96d481 100644 --- a/src/wp-admin/includes/class-bulk-upgrader-skin.php +++ b/src/wp-admin/includes/class-bulk-upgrader-skin.php @@ -43,7 +43,7 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { /* translators: 1: Title of an update */ $this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.'); /* translators: 1: Title of an update */ - $this->upgrader->strings['skin_update_successful'] = __( '%1$s updated successfully.' ) . ' ' . __( 'Show Details' ) . ''; + $this->upgrader->strings['skin_update_successful'] = __( '%1$s updated successfully.' ); $this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.'); } @@ -128,6 +128,7 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { $this->in_loop = true; printf( '

' . $this->upgrader->strings['skin_before_update_header'] . '

', $title, $this->upgrader->update_current, $this->upgrader->update_count ); echo ''; + // This progress messages div gets moved via JavaScript when clicking on "Show details.". echo '

'; $this->flush_output(); } @@ -148,8 +149,13 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { echo ''; } if ( $this->result && ! is_wp_error( $this->result ) ) { - if ( ! $this->error ) - echo '

' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '

'; + if ( ! $this->error ) { + echo '
' . + '

' . sprintf( $this->upgrader->strings['skin_update_successful'], $title ) . + ' ' . + '

'; + } + echo ''; } diff --git a/src/wp-admin/js/common.js b/src/wp-admin/js/common.js index 59fd1b68c3..672836da36 100644 --- a/src/wp-admin/js/common.js +++ b/src/wp-admin/js/common.js @@ -978,6 +978,25 @@ $document.ready( function() { // Set initial focus on a specific element. $( '.wp-initial-focus' ).focus(); + + // Toggle update details on update-core.php. + $body.on( 'click', '.js-update-details-toggle', function() { + var $updateNotice = $( this ).closest( '.js-update-details' ), + $progressDiv = $( '#' + $updateNotice.data( 'update-details' ) ); + + /* + * When clicking on "Show details" move the progress div below the update + * notice. Make sure it gets moved just the first time. + */ + if ( ! $progressDiv.hasClass( 'update-details-moved' ) ) { + $progressDiv.insertAfter( $updateNotice ).addClass( 'update-details-moved' ); + } + + // Toggle the progress div visibility. + $progressDiv.toggle(); + // Toggle the Show Details button expanded state. + $( this ).attr( 'aria-expanded', $progressDiv.is( ':visible' ) ) + }) }); // Fire a custom jQuery event at the end of window resize