mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-13 06:07:23 +01:00
Updates: Improve experience for Bulk Actions when FTP is dismissed.
Merges [38221] to the 4.6 branch. Before this change, when a bulk update was canceled due dismissing the FTP credentials modal, part of the actions didn't get canceled. This meant the "There is a new version of…” notices become blank and the updates you had checked became unchecked. Now, the notices remain and you are essentially returned to the screen you had before. Strings are also updated to improve ARIA usage. Fixes #37563. Props ocean90, swissspidy, obenland, afercia. Built from https://develop.svn.wordpress.org/branches/4.6@38222 git-svn-id: http://core.svn.wordpress.org/branches/4.6@38163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
14fa6a89ca
commit
c63e673361
@ -476,6 +476,8 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
$action_links[] = '<button type="button" class="button button-disabled" disabled="disabled">' . _x( 'Active', 'plugin' ) . '</button>';
|
||||
} elseif ( current_user_can( 'activate_plugins' ) ) {
|
||||
$button_text = __( 'Activate' );
|
||||
/* translators: %s: Plugin name */
|
||||
$button_label = _x( 'Activate %s', 'plugin' );
|
||||
$activate_url = add_query_arg( array(
|
||||
'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
|
||||
'action' => 'activate',
|
||||
@ -484,14 +486,15 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
|
||||
|
||||
if ( is_network_admin() ) {
|
||||
$button_text = __( 'Network Activate' );
|
||||
/* translators: %s: Plugin name */
|
||||
$button_label = _x( 'Network Activate %s', 'plugin' );
|
||||
$activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
|
||||
}
|
||||
|
||||
$action_links[] = sprintf(
|
||||
'<a href="%1$s" class="button activate-now button-secondary" aria-label="%2$s">%3$s</a>',
|
||||
esc_url( $activate_url ),
|
||||
/* translators: %s: Plugin name */
|
||||
esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin['name'] ) ),
|
||||
esc_attr( sprintf( $button_label, $plugin['name'] ) ),
|
||||
$button_text
|
||||
);
|
||||
} else {
|
||||
|
@ -523,11 +523,14 @@
|
||||
$message = $( '[data-slug="' + args.slug + '"]' );
|
||||
}
|
||||
|
||||
$message.text( wp.updates.l10n.installing );
|
||||
if ( $message.html() !== wp.updates.l10n.installing ) {
|
||||
$message.data( 'originaltext', $message.html() );
|
||||
}
|
||||
|
||||
$message
|
||||
.addClass( 'updating-message' )
|
||||
.attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $message.data( 'name' ) ) );
|
||||
.attr( 'aria-label', wp.updates.l10n.pluginInstallingLabel.replace( '%s', $message.data( 'name' ) ) )
|
||||
.text( wp.updates.l10n.installing );
|
||||
|
||||
wp.a11y.speak( wp.updates.l10n.installingMsg, 'polite' );
|
||||
|
||||
@ -1505,7 +1508,7 @@
|
||||
// Restore callbacks.
|
||||
response = wp.updates._addCallbacks( response, action );
|
||||
|
||||
wp.updates.queue.push( {
|
||||
wp.updates.queue.unshift( {
|
||||
action: action,
|
||||
|
||||
/*
|
||||
@ -1708,13 +1711,11 @@
|
||||
$updatingMessage.removeClass( 'updating-message' );
|
||||
} else if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
|
||||
$message = $( 'tr[data-plugin="' + job.data.plugin + '"]' ).find( '.update-message' );
|
||||
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
||||
$message = $( '.update-now.updating-message' );
|
||||
} else {
|
||||
$message = $updatingMessage;
|
||||
}
|
||||
|
||||
if ( $message ) {
|
||||
if ( $message && $message.hasClass( 'updating-message' ) ) {
|
||||
originalText = $message.data( 'originaltext' );
|
||||
|
||||
if ( 'undefined' === typeof originalText ) {
|
||||
@ -1724,6 +1725,14 @@
|
||||
$message
|
||||
.removeClass( 'updating-message' )
|
||||
.html( originalText );
|
||||
|
||||
if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
||||
if ( 'update-plugin' === job.action ) {
|
||||
$message.attr( 'aria-label', wp.updates.l10n.updateNowLabel.replace( '%s', $message.data( 'name' ) ) );
|
||||
} else if ( 'install-plugin' === job.action ) {
|
||||
$message.attr( 'aria-label', wp.updates.l10n.installNowLabel.replace( '%s', $message.data( 'name' ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wp.a11y.speak( wp.updates.l10n.updateCancel, 'polite' );
|
||||
@ -1999,14 +2008,14 @@
|
||||
|
||||
// Find all the checkboxes which have been checked.
|
||||
itemsSelected.each( function( index, element ) {
|
||||
var $checkbox = $( element ),
|
||||
var $checkbox = $( element ),
|
||||
$itemRow = $checkbox.parents( 'tr' );
|
||||
|
||||
// Un-check the box.
|
||||
$checkbox.prop( 'checked', false );
|
||||
|
||||
// Only add update-able items to the update queue.
|
||||
if ( 'update-selected' === bulkAction && ( ! $itemRow.hasClass( 'update' ) || $itemRow.find( 'notice-error' ).length ) ) {
|
||||
|
||||
// Un-check the box.
|
||||
$checkbox.prop( 'checked', false );
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2022,17 +2031,20 @@
|
||||
|
||||
// Display bulk notification for updates of any kind.
|
||||
$document.on( 'wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error', function( event, response ) {
|
||||
var $bulkActionNotice, itemName;
|
||||
var $itemRow = $( '[data-slug="' + response.slug + '"]' ),
|
||||
$bulkActionNotice, itemName;
|
||||
|
||||
if ( 'wp-' + response.update + '-update-success' === event.type ) {
|
||||
success++;
|
||||
} else {
|
||||
itemName = response.pluginName ? response.pluginName : $( '[data-slug="' + response.slug + '"]' ).find( '.column-primary strong' ).text();
|
||||
itemName = response.pluginName ? response.pluginName : $itemRow.find( '.column-primary strong' ).text();
|
||||
|
||||
error++;
|
||||
errorMessages.push( itemName + ': ' + response.errorMessage );
|
||||
}
|
||||
|
||||
$itemRow.find( 'input[name="checked[]"]:checked' ).prop( 'checked', false );
|
||||
|
||||
wp.updates.adminNotice = wp.template( 'wp-bulk-updates-admin-notice' );
|
||||
|
||||
wp.updates.addAdminNotice( {
|
||||
|
4
wp-admin/js/updates.min.js
vendored
4
wp-admin/js/updates.min.js
vendored
File diff suppressed because one or more lines are too long
@ -616,6 +616,8 @@ function wp_default_scripts( &$scripts ) {
|
||||
'updated' => __( 'Updated!' ),
|
||||
'update' => __( 'Update' ),
|
||||
'updateNow' => __( 'Update Now' ),
|
||||
/* translators: %s: Plugin name and version */
|
||||
'updateNowLabel' => __( 'Update %s now' ),
|
||||
'updateFailedShort' => __( 'Update Failed!' ),
|
||||
/* translators: %s: Error string for a failed update */
|
||||
'updateFailed' => __( 'Update Failed: %s' ),
|
||||
@ -634,7 +636,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
'beforeunload' => __( 'Updates may not complete if you navigate away from this page.' ),
|
||||
'installNow' => __( 'Install Now' ),
|
||||
/* translators: %s: Plugin name */
|
||||
'installNowLabel' => __( 'Install %s' ),
|
||||
'installNowLabel' => __( 'Install %s now' ),
|
||||
'installing' => __( 'Installing...' ),
|
||||
'installed' => __( 'Installed!' ),
|
||||
'installFailedShort' => __( 'Install Failed!' ),
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-RC1-38220';
|
||||
$wp_version = '4.6-RC1-38222';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user