Customizer: Indicate when there are no nav menu items available for a given type.

Props celloexpressions, valendesigns, rittesh.patel.
Fixes #32810.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-07-19 00:06:24 +00:00
parent afd7a8e836
commit 910092531b
8 changed files with 41 additions and 8 deletions

View File

@ -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: left;
margin-right: 5px;
}
#available-menu-items .accordion-section-content {
padding: 1px 15px 15px 15px;
margin: 0;

File diff suppressed because one or more lines are too long

View File

@ -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;

File diff suppressed because one or more lines are too long

View File

@ -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;
}

File diff suppressed because one or more lines are too long

View File

@ -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

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-beta3-33322';
$wp_version = '4.3-beta3-33323';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.