Make WordPress Core

Ticket #38112: 38112.2.diff

File 38112.2.diff, 4.0 KB (added by swissspidy, 7 years ago)
  • src/wp-admin/includes/update.php

    diff --git src/wp-admin/includes/update.php src/wp-admin/includes/update.php
    index 74899e3..6817f31 100644
    function wp_print_admin_notice_templates() { 
    690690                        <# } #>
    691691                </div>
    692692        </script>
     693        <script id="tmpl-wp-bulk-deletions-admin-notice" type="text/html">
     694                <div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
     695                        <p>
     696                                <# if ( data.successes ) { #>
     697                                        <# if ( 1 === data.successes ) { #>
     698                                                <# if ( 'plugin' === data.type ) { #>
     699                                                        <?php
     700                                                        /* translators: %s: Number of plugins */
     701                                                        printf( __( '%s plugin successfully deleted.' ), '{{ data.successes }}' );
     702                                                        ?>
     703                                                <# } else { #>
     704                                                        <?php
     705                                                        /* translators: %s: Number of themes */
     706                                                        printf( __( '%s theme successfully deleted.' ), '{{ data.successes }}' );
     707                                                        ?>
     708                                                <# } #>
     709                                        <# } else { #>
     710                                                <# if ( 'plugin' === data.type ) { #>
     711                                                        <?php
     712                                                        /* translators: %s: Number of plugins */
     713                                                        printf( __( '%s plugins successfully deleted.' ), '{{ data.successes }}' );
     714                                                        ?>
     715                                                <# } else { #>
     716                                                        <?php
     717                                                        /* translators: %s: Number of themes */
     718                                                        printf( __( '%s themes successfully deleted.' ), '{{ data.successes }}' );
     719                                                        ?>
     720                                                <# } #>
     721                                        <# } #>
     722                                <# } #>
     723                                <# if ( data.errors ) { #>
     724                                        <button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
     725                                                <# if ( 1 === data.errors ) { #>
     726                                                        <?php
     727                                                        /* translators: %s: Number of failed updates */
     728                                                        printf( __( '%s deletion failed.' ), '{{ data.errors }}' );
     729                                                        ?>
     730                                                <# } else { #>
     731                                                        <?php
     732                                                        /* translators: %s: Number of failed updates */
     733                                                        printf( __( '%s deletions failed.' ), '{{ data.errors }}' );
     734                                                        ?>
     735                                                <# } #>
     736                                                <span class="screen-reader-text"><?php _e( 'Show more details' ); ?></span>
     737                                                <span class="toggle-indicator" aria-hidden="true"></span>
     738                                        </button>
     739                                <# } #>
     740                        </p>
     741                        <# if ( data.errors ) { #>
     742                                <ul class="bulk-action-errors hidden">
     743                                        <# _.each( data.errorMessages, function( errorMessage ) { #>
     744                                                <li>{{ errorMessage }}</li>
     745                                        <# } ); #>
     746                                </ul>
     747                        <# } #>
     748                </div>
     749        </script>
    693750        <?php
    694751}
    695752
  • src/wp-admin/js/updates.js

    diff --git src/wp-admin/js/updates.js src/wp-admin/js/updates.js
    index 200241b..99d7860 100644
     
    848848                        } );
    849849
    850850                if ( response.plugin ) {
    851                         $plugin          = $( 'tr.inactive[data-plugin="' + response.plugin + '"]' );
     851                        $plugin          = $( 'tr[data-plugin="' + response.plugin + '"]' );
    852852                        $pluginUpdateRow = $plugin.siblings( '[data-plugin="' + response.plugin + '"]' );
    853853                } else {
    854                         $plugin          = $( 'tr.inactive[data-slug="' + response.slug + '"]' );
     854                        $plugin          = $( 'tr[data-slug="' + response.slug + '"]' );
    855855                        $pluginUpdateRow = $plugin.siblings( '[data-slug="' + response.slug + '"]' );
    856856                }
    857857
     
    20522052                        } );
    20532053
    20542054                        // Display bulk notification for updates of any kind.
    2055                         $document.on( 'wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error', function( event, response ) {
     2055                        $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 ) {
    20562056                                var $itemRow = $( '[data-slug="' + response.slug + '"]' ),
    20572057                                        $bulkActionNotice, itemName;
    20582058
     
    20672067
    20682068                                $itemRow.find( 'input[name="checked[]"]:checked' ).prop( 'checked', false );
    20692069
    2070                                 wp.updates.adminNotice = wp.template( 'wp-bulk-updates-admin-notice' );
     2070                                if ( -1 !== event.type.indexOf( '-update-' ) ) {
     2071                                        wp.updates.adminNotice = wp.template( 'wp-bulk-updates-admin-notice' );
     2072                                } else {
     2073                                        wp.updates.adminNotice = wp.template( 'wp-bulk-deletions-admin-notice' );
     2074                                }
    20712075
    20722076                                wp.updates.addAdminNotice( {
    20732077                                        id:            'bulk-action-notice',