Menus: Remove bulk action checkboxes when menu is empty.

This changeset removes the bulk action checkboxes when there is no menu item to select.

Follow-up to [51006], [51539].

Props oglekler, krishaweb, costdev, Boniu91, hugodevos, audrasjb.
Fixes #54799.
See #21603, #53654.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-09-26 21:44:09 +00:00
parent fd8b414c5f
commit d6e06921a8
4 changed files with 19 additions and 4 deletions

View File

@ -1557,4 +1557,19 @@
});
});
// Show bulk action
$( document ).on( 'menu-item-added', function() {
if ( ! $( '.bulk-actions' ).is( ':visible' ) ) {
$( '.bulk-actions' ).show();
}
} );
// Hide bulk action
$( document ).on( 'menu-removing-item', function( e, el ) {
var menuElement = $( el ).parents( '#menu-to-edit' );
if ( menuElement.find( 'li' ).length === 1 && $( '.bulk-actions' ).is( ':visible' ) ) {
$( '.bulk-actions' ).hide();
}
} );
})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -1000,7 +1000,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
</div>
<?php if ( ! $add_new_screen ) : ?>
<div id="nav-menu-bulk-actions-top" class="bulk-actions">
<div id="nav-menu-bulk-actions-top" class="bulk-actions" <?php echo $hide_style; ?>>
<label class="bulk-select-button" for="bulk-select-switcher-top">
<input type="checkbox" id="bulk-select-switcher-top" name="bulk-select-switcher-top" class="bulk-select-switcher">
<span class="bulk-select-button-label"><?php _e( 'Bulk Select' ); ?></span>
@ -1035,7 +1035,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<?php if ( ! $add_new_screen ) : ?>
<div id="nav-menu-bulk-actions-bottom" class="bulk-actions">
<div id="nav-menu-bulk-actions-bottom" class="bulk-actions" <?php echo $hide_style; ?>>
<label class="bulk-select-button" for="bulk-select-switcher-bottom">
<input type="checkbox" id="bulk-select-switcher-bottom" name="bulk-select-switcher-top" class="bulk-select-switcher">
<span class="bulk-select-button-label"><?php _e( 'Bulk Select' ); ?></span>

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-beta1-54315';
$wp_version = '6.1-beta1-54316';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.