Menus: Hide controls in the search tab if no items are found.

Props sayedwp, afercia, tywayne, abrightclearweb.
Fixes #35576.
Built from https://develop.svn.wordpress.org/trunk@38754


git-svn-id: http://core.svn.wordpress.org/trunk@38697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-10-07 20:56:29 +00:00
parent 859498efd3
commit 5fd943f49c
8 changed files with 24 additions and 6 deletions

View File

@ -27,6 +27,10 @@ ul.add-menu-item-tabs li {
margin-bottom: 0;
}
.has-no-menu-item .button-controls {
display: none;
}
#nav-menus-frame {
margin-right: 300px;
margin-top: 23px;

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,10 @@ ul.add-menu-item-tabs li {
margin-bottom: 0;
}
.has-no-menu-item .button-controls {
display: none;
}
#nav-menus-frame {
margin-left: 300px;
margin-top: 23px;

File diff suppressed because one or more lines are too long

View File

@ -571,7 +571,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $box ) {
),
remove_query_arg( $removed_args )
));
?>#posttype-<?php echo $post_type_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
?>#posttype-<?php echo $post_type_name; ?>" class="select-all aria-button-if-js"><?php _e( 'Select All' ); ?></a>
</span>
<span class="add-to-menu">
@ -769,7 +769,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {
),
remove_query_arg($removed_args)
));
?>#taxonomy-<?php echo $taxonomy_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
?>#taxonomy-<?php echo $taxonomy_name; ?>" class="select-all aria-button-if-js"><?php _e( 'Select All' ); ?></a>
</span>
<span class="add-to-menu">

View File

@ -1060,6 +1060,13 @@ var wpNavMenu;
// select the search bar
$('.quick-search', wrapper).focus();
// Hide controls in the search tab if no items found.
if ( ! wrapper.find( '.tabs-panel-active .menu-item-title' ).length ) {
wrapper.addClass( 'has-no-menu-item' );
} else {
wrapper.removeClass( 'has-no-menu-item' );
}
e.preventDefault();
} else if ( target.hasClass('select-all') ) {
selectAreaMatch = /#(.*)$/.exec(e.target.href);
@ -1192,11 +1199,13 @@ var wpNavMenu;
form = document.getElementById('nav-menu-meta'),
pattern = /menu-item[(\[^]\]*/,
$items = $('<div>').html(resp).find('li'),
wrapper = panel.closest( '.accordion-section-content' ),
$item;
if( ! $items.length ) {
$('.categorychecklist', panel).html( '<li><p>' + navMenuL10n.noResultsFound + '</p></li>' );
$( '.spinner', panel ).removeClass( 'is-active' );
wrapper.addClass( 'has-no-menu-item' );
return;
}
@ -1224,6 +1233,7 @@ var wpNavMenu;
$('.categorychecklist', panel).html( $items );
$( '.spinner', panel ).removeClass( 'is-active' );
wrapper.removeClass( 'has-no-menu-item' );
},
removeMenuItem : function(el) {

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38753';
$wp_version = '4.7-alpha-38754';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.