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.


Built from https://develop.svn.wordpress.org/trunk@38175


git-svn-id: http://core.svn.wordpress.org/trunk@38116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2016-07-31 18:57:28 +00:00
parent 672cf2766e
commit 472e0d1978
3 changed files with 14 additions and 4 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-RC1-38174'; $wp_version = '4.6-RC1-38175';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.