Updates: Add visual feedback when deleting themes/plugins.
This corrects the selector for the delete link in `wp.updates.deletePlugin()` so the text can be changed to 'Deleting…'. `wp.updates.deleteTheme()` already worked on wp-admin/themes.php but not on wp-admin/network/themes.php because the network screen is similar to the plugins list table, this is now fixed too. The `credential-modal-cancel` handler has been updated to support canceled delete jobs. Merge of [38227] to the 4.6 branch. Props swissspidy. Props jorbin for review. See #37603. Built from https://develop.svn.wordpress.org/branches/4.6@38228 git-svn-id: http://core.svn.wordpress.org/branches/4.6@38169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8631cb86cf
commit
9c0dfce2ac
|
@ -716,15 +716,17 @@
|
||||||
* decorated with an abort() method.
|
* decorated with an abort() method.
|
||||||
*/
|
*/
|
||||||
wp.updates.deletePlugin = function( args ) {
|
wp.updates.deletePlugin = function( args ) {
|
||||||
var $message = $( '[data-plugin="' + args.plugin + '"]' ).find( '.update-message p' );
|
var $link = $( '[data-plugin="' + args.plugin + '"]' ).find( '.row-actions a.delete' );
|
||||||
|
|
||||||
args = _.extend( {
|
args = _.extend( {
|
||||||
success: wp.updates.deletePluginSuccess,
|
success: wp.updates.deletePluginSuccess,
|
||||||
error: wp.updates.deletePluginError
|
error: wp.updates.deletePluginError
|
||||||
}, args );
|
}, args );
|
||||||
|
|
||||||
if ( $message.html() !== wp.updates.l10n.updating ) {
|
if ( $link.html() !== wp.updates.l10n.deleting ) {
|
||||||
$message.data( 'originaltext', $message.html() );
|
$link
|
||||||
|
.data( 'originaltext', $link.html() )
|
||||||
|
.text( wp.updates.l10n.deleting );
|
||||||
}
|
}
|
||||||
|
|
||||||
wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
|
wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
|
||||||
|
@ -1168,18 +1170,25 @@
|
||||||
* decorated with an abort() method.
|
* decorated with an abort() method.
|
||||||
*/
|
*/
|
||||||
wp.updates.deleteTheme = function( args ) {
|
wp.updates.deleteTheme = function( args ) {
|
||||||
var $button = $( '.theme-actions .delete-theme' );
|
var $button;
|
||||||
|
|
||||||
|
if ( 'themes' === pagenow ) {
|
||||||
|
$button = $( '.theme-actions .delete-theme' );
|
||||||
|
} else if ( 'themes-network' === pagenow ) {
|
||||||
|
$button = $( '[data-slug="' + args.slug + '"]' ).find( '.row-actions a.delete' );
|
||||||
|
}
|
||||||
|
|
||||||
args = _.extend( {
|
args = _.extend( {
|
||||||
success: wp.updates.deleteThemeSuccess,
|
success: wp.updates.deleteThemeSuccess,
|
||||||
error: wp.updates.deleteThemeError
|
error: wp.updates.deleteThemeError
|
||||||
}, args );
|
}, args );
|
||||||
|
|
||||||
if ( $button.html() !== wp.updates.l10n.deleting ) {
|
if ( $button && $button.html() !== wp.updates.l10n.deleting ) {
|
||||||
$button.data( 'originaltext', $button.html() );
|
$button
|
||||||
|
.data( 'originaltext', $button.html() )
|
||||||
|
.text( wp.updates.l10n.deleting );
|
||||||
}
|
}
|
||||||
|
|
||||||
$button.text( wp.updates.l10n.deleting );
|
|
||||||
wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
|
wp.a11y.speak( wp.updates.l10n.deleting, 'polite' );
|
||||||
|
|
||||||
// Remove previous error messages, if any.
|
// Remove previous error messages, if any.
|
||||||
|
@ -1710,7 +1719,19 @@
|
||||||
if ( 'import' === pagenow ) {
|
if ( 'import' === pagenow ) {
|
||||||
$updatingMessage.removeClass( 'updating-message' );
|
$updatingMessage.removeClass( 'updating-message' );
|
||||||
} else if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
} else if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
||||||
$message = $( 'tr[data-plugin="' + job.data.plugin + '"]' ).find( '.update-message' );
|
if ( 'update-plugin' === job.action ) {
|
||||||
|
$message = $( 'tr[data-plugin="' + job.data.plugin + '"]' ).find( '.update-message' );
|
||||||
|
} else if ( 'delete-plugin' === job.action ) {
|
||||||
|
$message = $( '[data-plugin="' + job.data.plugin + '"]' ).find( '.row-actions a.delete' );
|
||||||
|
}
|
||||||
|
} else if ( 'themes' === pagenow || 'themes-network' === pagenow ) {
|
||||||
|
if ( 'update-theme' === job.action ) {
|
||||||
|
$message = $( '[data-slug="' + job.data.slug + '"]' ).find( '.update-message' );
|
||||||
|
} else if ( 'delete-theme' === job.action && 'themes-network' === pagenow ) {
|
||||||
|
$message = $( '[data-slug="' + job.data.slug + '"]' ).find( '.row-actions a.delete' );
|
||||||
|
} else if ( 'delete-theme' === job.action && 'themes' === pagenow ) {
|
||||||
|
$message = $( '.theme-actions .delete-theme' );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$message = $updatingMessage;
|
$message = $updatingMessage;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-RC1-38226';
|
$wp_version = '4.6-RC1-38228';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue