Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/js/_enqueues/wp/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -1496,10 +1496,10 @@
} );

if ( response.plugin ) {
$plugin = $( 'tr.inactive[data-plugin="' + response.plugin + '"]' );
$plugin = $( 'tr[data-plugin="' + response.plugin + '"]' );
$pluginUpdateRow = $plugin.siblings( '[data-plugin="' + response.plugin + '"]' );
} else {
$plugin = $( 'tr.inactive[data-slug="' + response.slug + '"]' );
$plugin = $( 'tr[data-slug="' + response.slug + '"]' );
$pluginUpdateRow = $plugin.siblings( '[data-slug="' + response.slug + '"]' );
}

Expand Down Expand Up @@ -2898,7 +2898,7 @@
} );

// Display bulk notification for updates of any kind.
$document.on( 'wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error', function( event, response ) {
$document.on( 'wp-plugin-update-success wp-plugin-update-error wp-plugin-delete-error wp-theme-update-success wp-theme-update-error wp-theme-delete-error', function( event, response ) {
var $itemRow = $( '[data-slug="' + response.slug + '"]' ),
$bulkActionNotice, itemName;

Expand All @@ -2913,7 +2913,11 @@

$itemRow.find( 'input[name="checked[]"]:checked' ).prop( 'checked', false );

wp.updates.adminNotice = wp.template( 'wp-bulk-updates-admin-notice' );
if ( -1 !== event.type.indexOf( '-update-' ) ) {
wp.updates.adminNotice = wp.template( 'wp-bulk-updates-admin-notice' );
} else {
wp.updates.adminNotice = wp.template( 'wp-bulk-deletions-admin-notice' );
}

var successMessage = null;

Expand Down
62 changes: 62 additions & 0 deletions src/wp-admin/includes/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,68 @@ function wp_print_admin_notice_templates() {
<# } #>
</div>
</script>
<script id="tmpl-wp-bulk-deletions-admin-notice" type="text/html">
<#
// Only render the notice if we have successes or errors.
if ( data.successes || data.errors ) {
#>
<div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
<p>
<# if ( data.successes ) { #>
<# if ( 1 === data.successes ) { #>
<# if ( 'plugin' === data.type ) { #>
<?php
/* translators: %s: Number of plugins */
printf( __( '%s plugin successfully deleted.' ), '{{ data.successes }}' );
?>
<# } else { #>
<?php
/* translators: %s: Number of themes */
printf( __( '%s theme successfully deleted.' ), '{{ data.successes }}' );
?>
<# } #>
<# } else { #>
<# if ( 'plugin' === data.type ) { #>
<?php
/* translators: %s: Number of plugins */
printf( __( '%s plugins successfully deleted.' ), '{{ data.successes }}' );
?>
<# } else { #>
<?php
/* translators: %s: Number of themes */
printf( __( '%s themes successfully deleted.' ), '{{ data.successes }}' );
?>
<# } #>
<# } #>
<# } #>
<# if ( data.errors ) { #>
<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
<# if ( 1 === data.errors ) { #>
<?php
/* translators: %s: Number of failed updates */
printf( __( '%s deletion failed.' ), '{{ data.errors }}' );
?>
<# } else { #>
<?php
/* translators: %s: Number of failed updates */
printf( __( '%s deletions failed.' ), '{{ data.errors }}' );
?>
<# } #>
<span class="screen-reader-text"><?php _e( 'Show more details' ); ?></span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
<# } #>
</p>
<# if ( data.errors ) { #>
<ul class="bulk-action-errors hidden">
<# _.each( data.errorMessages, function( errorMessage ) { #>
<li>{{ errorMessage }}</li>
<# } ); #>
</ul>
<# } #>
</div>
<# } #>
</script>
<?php
}

Expand Down
Loading