[wp-trac] [WordPress Trac] #42116: Customize Menus: Add "It doesn't look like your site has any menus yet" view

WordPress Trac noreply at wordpress.org
Tue Oct 10 07:30:24 UTC 2017


#42116: Customize Menus: Add "It doesn't look like your site has any menus yet"
view
----------------------------+-----------------------
 Reporter:  melchoyce       |       Owner:  bpayton
     Type:  task (blessed)  |      Status:  assigned
 Priority:  normal          |   Milestone:  4.9
Component:  Customize       |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  ui
----------------------------+-----------------------

Comment (by westonruter):

 @bpayton Couldn't these new paragraphs just be added to the content output
 in `\WP_Customize_New_Menu_Section::render()`, as a `div.create-nav-menus-
 notice` before the `button`? It could be `hidden` by default but then
 there could be JS like:

 {{{#!js
 api.section( 'add_menu', function( section ) {
         var updateNoticeVisibility;

         function getNavMenuCount() {
                 var count = 0;
                 api.each( function( setting ) {
                         if ( /^nav_menu\[/.test( setting.id ) && false !==
 setting.get() ) {
                                 count += 1;
                         }
                 } );
                 return count;
         }

         var updateNoticeVisibility = _.debounce( function() {
                 section.headContainer.find( '.create-nav-menus-notice'
 ).toggle( 0 === getNavMenuCount() );
         } );
         api.bind( 'add', updateNoticeVisibility );
         api.bind( 'removed', updateNoticeVisibility );
         api.bind( 'ready', updateNoticeVisibility );
 } );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42116#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list