Plugins: Update item count when plugin deleted.
Update the item count, "N items", on the plugin list when a plugin is deleted. This matches the live updating of various other counts on the screen. Props mitogh, costdev, azouamauriac, swissspidy, kebbet. Fixes #55316. Built from https://develop.svn.wordpress.org/trunk@53124 git-svn-id: http://core.svn.wordpress.org/trunk@52713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ce1dd08c07
commit
cf4f9c9e61
|
@ -34,6 +34,7 @@
|
||||||
__ = wp.i18n.__,
|
__ = wp.i18n.__,
|
||||||
_x = wp.i18n._x,
|
_x = wp.i18n._x,
|
||||||
_n = wp.i18n._n,
|
_n = wp.i18n._n,
|
||||||
|
_nx = wp.i18n._nx,
|
||||||
sprintf = wp.i18n.sprintf;
|
sprintf = wp.i18n.sprintf;
|
||||||
|
|
||||||
wp = wp || {};
|
wp = wp || {};
|
||||||
|
@ -970,6 +971,8 @@
|
||||||
var $form = $( '#bulk-action-form' ),
|
var $form = $( '#bulk-action-form' ),
|
||||||
$views = $( '.subsubsub' ),
|
$views = $( '.subsubsub' ),
|
||||||
$pluginRow = $( this ),
|
$pluginRow = $( this ),
|
||||||
|
$currentView = $views.find( '[aria-current="page"]' ),
|
||||||
|
$itemsCount = $( '.displaying-num' ),
|
||||||
columnCount = $form.find( 'thead th:not(.hidden), thead td' ).length,
|
columnCount = $form.find( 'thead th:not(.hidden), thead td' ).length,
|
||||||
pluginDeletedRow = wp.template( 'item-deleted-row' ),
|
pluginDeletedRow = wp.template( 'item-deleted-row' ),
|
||||||
/**
|
/**
|
||||||
|
@ -977,7 +980,8 @@
|
||||||
*
|
*
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
plugins = settings.plugins;
|
plugins = settings.plugins,
|
||||||
|
remainingCount;
|
||||||
|
|
||||||
// Add a success message after deleting a plugin.
|
// Add a success message after deleting a plugin.
|
||||||
if ( ! $pluginRow.hasClass( 'plugin-update-tr' ) ) {
|
if ( ! $pluginRow.hasClass( 'plugin-update-tr' ) ) {
|
||||||
|
@ -1057,6 +1061,17 @@
|
||||||
$form.find( '#the-list' ).append( '<tr class="no-items"><td class="colspanchange" colspan="' + columnCount + '">' + __( 'No plugins are currently available.' ) + '</td></tr>' );
|
$form.find( '#the-list' ).append( '<tr class="no-items"><td class="colspanchange" colspan="' + columnCount + '">' + __( 'No plugins are currently available.' ) + '</td></tr>' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $itemsCount.length && $currentView.length ) {
|
||||||
|
remainingCount = plugins[ $currentView.parent( 'li' ).attr('class') ].length;
|
||||||
|
$itemsCount.text(
|
||||||
|
sprintf(
|
||||||
|
/* translators: %s: The remaining number of plugins. */
|
||||||
|
_nx( '%s item', '%s items', 'plugin/plugins', remainingCount ),
|
||||||
|
remainingCount
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
wp.a11y.speak( _x( 'Deleted!', 'plugin' ) );
|
wp.a11y.speak( _x( 'Deleted!', 'plugin' ) );
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1340,7 +1340,7 @@ function wp_default_scripts( $scripts ) {
|
||||||
$scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
|
$scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
|
||||||
$scripts->set_translations( 'privacy-tools' );
|
$scripts->set_translations( 'privacy-tools' );
|
||||||
|
|
||||||
$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'common', 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize' ), false, 1 );
|
$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'common', 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize', 'wp-i18n' ), false, 1 );
|
||||||
$scripts->set_translations( 'updates' );
|
$scripts->set_translations( 'updates' );
|
||||||
did_action( 'init' ) && $scripts->localize(
|
did_action( 'init' ) && $scripts->localize(
|
||||||
'updates',
|
'updates',
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.0-alpha-53123';
|
$wp_version = '6.0-alpha-53124';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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