Ticket #32710: 32710.6.diff
File 32710.6.diff, 4.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/css/customize-nav-menus.css
584 584 bottom: 0; 585 585 left: -301px; 586 586 visibility: hidden; 587 overflow: hidden; 587 overflow-x: hidden; 588 overflow-y: auto; 588 589 width: 300px; 589 590 margin: 0; 590 591 z-index: 4; … … 598 599 overflow-y: auto; 599 600 } 600 601 602 #available-menu-items #available-menu-items-search.open { 603 border-bottom: none; 604 } 605 601 606 #available-menu-items .accordion-section-title { 602 607 border-left: none; 603 608 border-right: none; 604 609 background: #fff; 605 610 } 606 611 607 #available-menu-items .open .accordion-section-title { 612 #available-menu-items .open .accordion-section-title, 613 #available-menu-items #available-menu-items-search .accordion-section-title { 608 614 background: #eee; 609 615 } 610 616 … … 696 702 max-height: 290px; 697 703 } 698 704 705 #available-menu-items #available-menu-items-search .accordion-section-content { 706 position: absolute; 707 top: 60px; /* below title div / search input */ 708 bottom: 0px; /* 100% height that still triggers lazy load */ 709 max-height: none; 710 } 711 699 712 #available-menu-items .menu-item-tpl { 700 713 margin: 0; 701 714 } -
src/wp-admin/js/customize-nav-menus.js
96 96 events: { 97 97 'input #menu-items-search': 'debounceSearch', 98 98 'keyup #menu-items-search': 'debounceSearch', 99 'click #menu-items-search': 'debounceSearch',100 99 'focus .menu-item-tpl': 'focus', 101 100 'click .menu-item-tpl': '_submit', 102 101 'click #custom-menu-item-submit': '_submitLink', … … 176 175 // Search input change handler. 177 176 search: function( event ) { 178 177 var $searchSection = $( '#available-menu-items-search' ), 179 $o penSections = $( '#available-menu-items .accordion-section.open');178 $otherSections = $( '#available-menu-items .accordion-section' ).not( $searchSection ); 180 179 181 180 if ( ! event ) { 182 181 return; 183 182 } 184 // Manual accordion-opening behavior. 185 if ( this.searchTerm && ! $searchSection.hasClass( 'open' ) ) { 186 $openSections.find( '.accordion-section-content' ).slideUp( 'fast' ); 183 184 if ( this.searchTerm === event.target.value ) { 185 return; 186 } 187 188 if ( '' !== event.target.value && ! $searchSection.hasClass( 'open' ) ) { 189 $otherSections.fadeOut( 100 ); 187 190 $searchSection.find( '.accordion-section-content' ).slideDown( 'fast' ); 188 $openSections.find( '[aria-expanded]' ).first().attr( 'aria-expanded', 'false' );189 $openSections.removeClass( 'open' );190 191 $searchSection.addClass( 'open' ); 191 } 192 if ( '' === event.target.value ) { 192 } else if ( '' === event.target.value ) { 193 193 $searchSection.removeClass( 'open' ); 194 $otherSections.show(); 194 195 } 195 if ( this.searchTerm === event.target.value ) { 196 return; 197 } 196 198 197 this.searchTerm = event.target.value; 199 198 this.pages.search = 1; 200 199 this.doSearch( 1 ); … … 264 263 self.currentRequest.fail(function( data ) { 265 264 // data.message may be undefined, for example when typing slow and the request is aborted. 266 265 if ( data.message ) { 267 $content.empty().append( $( '< p class="nothing-found"></p>' ).text( data.message ) );266 $content.empty().append( $( '<div class="nothing-found"></p>' ).html( data.message ) ); 268 267 wp.a11y.speak( data.message ); 269 268 } 270 269 self.pages.search = -1; -
src/wp-includes/class-wp-customize-nav-menus.php
217 217 $items = $this->search_available_items_query( array( 'pagenum' => $p, 's' => $s ) ); 218 218 219 219 if ( empty( $items ) ) { 220 wp_send_json_error( array( 'message' => __( 'No menu items found.' )) );220 wp_send_json_error( array( 'message' => '<p>' . __( 'No results found.' ) . '</p><p>' . __( 'You must create and publish content before you can add it as a menu item. You can also add links to external sites in the Custom Links section.' ) . '</p>' ) ); 221 221 } else { 222 222 wp_send_json_success( array( 'items' => $items ) ); 223 223 } -
tests/phpunit/tests/ajax/CustomizeMenus.php
520 520 array( 521 521 'success' => false, 522 522 'data' => array( 523 'message' => ' No menu items found.',523 'message' => '<p>No menu items found.</p><p>You must create and publish content before you can add it as a menu item. You can also add links to external sites in the Custom Links section.</p>', 524 524 ), 525 525 ), 526 526 ),