WordPress.org

Make WordPress Core

Changeset 38175


Ignore:
Timestamp:
07/31/2016 06:56:57 PM (3 years ago)
Author:
jorbin
Message:

Upgrade/Install: Trigger additional JS events in shiny updates

Events for updating exist, but they lack context. This adds args so that plugins can detec t what plugin/theme is being installed. Additionally, events for bulk actions, deleting and that and install is starting didn't exist, so this adds them.

Fixes #37512.
Props DavidAnderson, and ocean90, swissspidy for review.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/updates.js

    r38168 r38175  
    370370            .text( wp.updates.l10n.updating );
    371371
    372         $document.trigger( 'wp-plugin-updating' );
     372        $document.trigger( 'wp-plugin-updating', args );
    373373
    374374        return wp.updates.ajax( 'update-plugin', args );
     
    526526        $card.removeClass( 'plugin-card-install-failed' ).find( '.notice.notice-error' ).remove();
    527527
     528        $document.trigger( 'wp-plugin-installing', args );
     529       
    528530        return wp.updates.ajax( 'install-plugin', args );
    529531    };
     
    716718        wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
    717719
     720        $document.trigger( 'wp-plugin-deleting', args );
     721       
    718722        return wp.updates.ajax( 'delete-plugin', args );
    719723    };
     
    906910        $notice.text( wp.updates.l10n.updating );
    907911
    908         $document.trigger( 'wp-theme-updating' );
     912        $document.trigger( 'wp-theme-updating', args );
    909913
    910914        return wp.updates.ajax( 'update-theme', args );
     
    10391043        $( '.install-theme-info, [data-slug="' + args.slug + '"]' ).removeClass( 'theme-install-failed' ).find( '.notice.notice-error' ).remove();
    10401044
     1045        $document.trigger( 'wp-theme-installing', args );
     1046       
    10411047        return wp.updates.ajax( 'install-theme', args );
    10421048    };
     
    11681174        $( '.theme-info .update-message' ).remove();
    11691175
     1176        $document.trigger( 'wp-theme-deleting', args );
     1177       
    11701178        return wp.updates.ajax( 'delete-theme', args );
    11711179    };
     
    19741982            $bulkActionForm.find( '.manage-column [type="checkbox"]' ).prop( 'checked', false );
    19751983
     1984            $document.trigger( 'wp-' + type + '-bulk-' + bulkAction, itemsSelected );
     1985           
    19761986            // Find all the checkboxes which have been checked.
    19771987            itemsSelected.each( function( index, element ) {
Note: See TracChangeset for help on using the changeset viewer.