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.



git-svn-id: https://develop.svn.wordpress.org/trunk@38175 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Aaron Jorbin 2016-07-31 18:56:57 +00:00
parent 48078058d7
commit 11a5970263
1 changed files with 12 additions and 2 deletions

View File

@ -369,7 +369,7 @@
.attr( 'aria-label', message )
.text( wp.updates.l10n.updating );
$document.trigger( 'wp-plugin-updating' );
$document.trigger( 'wp-plugin-updating', args );
return wp.updates.ajax( 'update-plugin', args );
};
@ -525,6 +525,8 @@
// Remove previous error messages, if any.
$card.removeClass( 'plugin-card-install-failed' ).find( '.notice.notice-error' ).remove();
$document.trigger( 'wp-plugin-installing', args );
return wp.updates.ajax( 'install-plugin', args );
};
@ -715,6 +717,8 @@
wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
$document.trigger( 'wp-plugin-deleting', args );
return wp.updates.ajax( 'delete-plugin', args );
};
@ -905,7 +909,7 @@
wp.a11y.speak( wp.updates.l10n.updatingMsg, 'polite' );
$notice.text( wp.updates.l10n.updating );
$document.trigger( 'wp-theme-updating' );
$document.trigger( 'wp-theme-updating', args );
return wp.updates.ajax( 'update-theme', args );
};
@ -1038,6 +1042,8 @@
// Remove previous error messages, if any.
$( '.install-theme-info, [data-slug="' + args.slug + '"]' ).removeClass( 'theme-install-failed' ).find( '.notice.notice-error' ).remove();
$document.trigger( 'wp-theme-installing', args );
return wp.updates.ajax( 'install-theme', args );
};
@ -1167,6 +1173,8 @@
// Remove previous error messages, if any.
$( '.theme-info .update-message' ).remove();
$document.trigger( 'wp-theme-deleting', args );
return wp.updates.ajax( 'delete-theme', args );
};
@ -1973,6 +1981,8 @@
// Un-check the bulk checkboxes.
$bulkActionForm.find( '.manage-column [type="checkbox"]' ).prop( 'checked', false );
$document.trigger( 'wp-' + type + '-bulk-' + bulkAction, itemsSelected );
// Find all the checkboxes which have been checked.
itemsSelected.each( function( index, element ) {
var $checkbox = $( element ),