Make WordPress Core

Changeset 33323


Ignore:
Timestamp:
07/19/2015 12:05:26 AM (9 years ago)
Author:
westonruter
Message:

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

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

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/customize-nav-menus.css

    r33282 r33323  
    656656}
    657657
     658#available-menu-items .accordion-section-title .no-items,
     659#available-menu-items .cannot-expand .accordion-section-title .spinner {
     660    display: none;
     661}
     662
     663#available-menu-items .cannot-expand .accordion-section-title .no-items {
     664    display: block;
     665    color: #777;
     666    font-weight: normal;
     667    float: right;
     668    margin-left: 5px;
     669}
     670
    658671#available-menu-items .accordion-section-content {
    659672    padding: 1px 15px 15px 15px;
  • trunk/src/wp-admin/js/customize-nav-menus.js

    r33283 r33323  
    299299            itemTemplate = wp.template( 'available-menu-item' );
    300300
    301             if ( 0 > self.pages[type] ) {
     301            if ( 0 > self.pages[ type ] ) {
    302302                return;
    303303            }
     
    317317                items = data.items;
    318318                if ( 0 === items.length ) {
     319                    if ( 0 === self.pages[ type ] ) {
     320                        $( '#available-menu-items-' + type )
     321                            .addClass( 'cannot-expand' )
     322                            .removeClass( 'loading' )
     323                            .find( '.accordion-section-title > button' )
     324                            .prop( 'tabIndex', -1 );
     325                    }
    319326                    self.pages[ type ] = -1;
    320327                    return;
  • trunk/src/wp-includes/class-wp-customize-nav-menus.php

    r33322 r33323  
    722722                    ?>
    723723                    <div id="available-menu-items-<?php echo esc_attr( $type->name ); ?>" class="accordion-section">
    724                         <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>
     724                        <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>
    725725                        <ul class="accordion-section-content" data-type="<?php echo esc_attr( $type->name ); ?>" data-obj_type="post_type"></ul>
    726726                    </div>
     
    734734                    ?>
    735735                    <div id="available-menu-items-<?php echo esc_attr( $tax->name ); ?>" class="accordion-section">
    736                         <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>
     736                        <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>
    737737                        <ul class="accordion-section-content" data-type="<?php echo esc_attr( $tax->name ); ?>" data-obj_type="taxonomy"></ul>
    738738                    </div>
Note: See TracChangeset for help on using the changeset viewer.