mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Customizer: Indicate when there are no nav menu items available for a given type.
Props celloexpressions, valendesigns, rittesh.patel. Fixes #32810. git-svn-id: https://develop.svn.wordpress.org/trunk@33323 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -655,6 +655,19 @@ button.not-a-button {
|
||||
box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, .8);
|
||||
}
|
||||
|
||||
#available-menu-items .accordion-section-title .no-items,
|
||||
#available-menu-items .cannot-expand .accordion-section-title .spinner {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#available-menu-items .cannot-expand .accordion-section-title .no-items {
|
||||
display: block;
|
||||
color: #777;
|
||||
font-weight: normal;
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#available-menu-items .accordion-section-content {
|
||||
padding: 1px 15px 15px 15px;
|
||||
margin: 0;
|
||||
|
||||
@@ -298,7 +298,7 @@
|
||||
var self = this, params, request, itemTemplate;
|
||||
itemTemplate = wp.template( 'available-menu-item' );
|
||||
|
||||
if ( 0 > self.pages[type] ) {
|
||||
if ( 0 > self.pages[ type ] ) {
|
||||
return;
|
||||
}
|
||||
$( '#available-menu-items-' + type + ' .accordion-section-title' ).addClass( 'loading' );
|
||||
@@ -316,6 +316,13 @@
|
||||
var items, typeInner;
|
||||
items = data.items;
|
||||
if ( 0 === items.length ) {
|
||||
if ( 0 === self.pages[ type ] ) {
|
||||
$( '#available-menu-items-' + type )
|
||||
.addClass( 'cannot-expand' )
|
||||
.removeClass( 'loading' )
|
||||
.find( '.accordion-section-title > button' )
|
||||
.prop( 'tabIndex', -1 );
|
||||
}
|
||||
self.pages[ type ] = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ final class WP_Customize_Nav_Menus {
|
||||
foreach ( $post_types as $type ) :
|
||||
?>
|
||||
<div id="available-menu-items-<?php echo esc_attr( $type->name ); ?>" class="accordion-section">
|
||||
<h4 class="accordion-section-title"><?php echo esc_html( $type->label ); ?> <span class="spinner"></span> <button type="button" class="not-a-button"><span class="screen-reader-text"><?php _e( 'Toggle' ); ?></span></button></h4>
|
||||
<h4 class="accordion-section-title"><?php echo esc_html( $type->label ); ?> <span class="spinner"></span> <span class="no-items"><?php _e( 'No items' ); ?></span> <button type="button" class="not-a-button"><span class="screen-reader-text"><?php _e( 'Toggle' ); ?></span></button></h4>
|
||||
<ul class="accordion-section-content" data-type="<?php echo esc_attr( $type->name ); ?>" data-obj_type="post_type"></ul>
|
||||
</div>
|
||||
<?php
|
||||
@@ -733,7 +733,7 @@ final class WP_Customize_Nav_Menus {
|
||||
foreach ( $taxonomies as $tax ) :
|
||||
?>
|
||||
<div id="available-menu-items-<?php echo esc_attr( $tax->name ); ?>" class="accordion-section">
|
||||
<h4 class="accordion-section-title"><?php echo esc_html( $tax->label ); ?> <span class="spinner"></span> <button type="button" class="not-a-button"><span class="screen-reader-text"><?php _e( 'Toggle' ); ?></span></button></h4>
|
||||
<h4 class="accordion-section-title"><?php echo esc_html( $tax->label ); ?> <span class="spinner"></span> <span class="no-items"><?php _e( 'No items' ); ?></span> <button type="button" class="not-a-button"><span class="screen-reader-text"><?php _e( 'Toggle' ); ?></span></button></h4>
|
||||
<ul class="accordion-section-content" data-type="<?php echo esc_attr( $tax->name ); ?>" data-obj_type="taxonomy"></ul>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user