Ticket #23119: 23119.10.diff

File 23119.10.diff, 7.6 KB (added by lessbloat, 5 months ago)
  • wp-admin/includes/nav-menu.php

     
    8080                } 
    8181 
    8282                $title = empty( $item->label ) ? $title : $item->label; 
     83                 
     84                $submenu_text = ''; 
     85                if (0 == $depth) 
     86                        $submenu_text = 'style="display: none;"'; 
    8387 
    8488                ?> 
    8589                <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>"> 
    8690                        <dl class="menu-item-bar"> 
    8791                                <dt class="menu-item-handle"> 
    88                                         <span class="item-title"><?php echo esc_html( $title ); ?></span> 
     92                                        <span class="item-title"><?php echo esc_html( $title ); ?> <span class="is-submenu" <?php echo $submenu_text; ?>><?php _e( 'sub menu' ); ?></span></span> 
    8993                                        <span class="item-controls"> 
    9094                                                <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span> 
    9195                                                <span class="item-order hide-if-js"> 
     
    383387function wp_nav_menu_setup() { 
    384388        // Register meta boxes 
    385389        if ( wp_get_nav_menus() ) 
    386                 add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' ); 
     390                add_meta_box( 'nav-menu-theme-locations', __( 'Menus within your theme' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' ); 
    387391        add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); 
    388392        wp_nav_menu_post_type_meta_boxes(); 
    389393        wp_nav_menu_taxonomy_meta_boxes(); 
     
    489493        $menu_locations = get_nav_menu_locations(); 
    490494        $num_locations = count( array_keys($locations) ); 
    491495 
    492         echo '<p class="howto">' . sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n($num_locations) ) . '</p>'; 
     496        echo '<p class="howto">' . _n('Select a menu to use within your theme.', 'Select the menus you will use in your theme.', $num_locations ) . '</p>'; 
    493497 
    494498        foreach ( $locations as $location => $description ) { 
    495499                ?> 
  • wp-admin/js/nav-menu.js

     
    4848                        this.initToggles(); 
    4949 
    5050                        this.initTabManager(); 
     51                         
     52                        this.messageFadeIn(); 
    5153                }, 
    5254 
    5355                jQueryExtensions : function() { 
     
    222224                                } 
    223225                        }); 
    224226                }, 
     227                 
     228                messageFadeIn : function() { 
     229                        var messages = $('#message'); 
     230                         
     231                        // Visual change when users save menus multiple times in a row 
     232                        if (messages.is(':visible')) 
     233                                messages.hide().slideDown('slow'); 
     234                }, 
    225235 
    226236                initToggles : function() { 
    227237                        // init postboxes 
     
    245255                                menuEdge = api.menuList.offset().left, 
    246256                                body = $('body'), maxChildDepth, 
    247257                                menuMaxDepth = initialMenuMaxDepth(); 
     258                                 
     259                        if( 0 != $('#menu-to-edit li').length ) 
     260                                $('.drag-instructions').show(); 
    248261 
    249262                        // Use the right edge if RTL. 
    250263                        menuEdge += api.isRTL ? api.menuList.width() : 0; 
     
    307320 
    308321                                        // Return child elements to the list 
    309322                                        children = transport.children().insertAfter(ui.item); 
     323                                         
     324                                        // Add "sub menu" description 
     325                                        var subMenuTitle = ui.item.find('.item-title .is-submenu'); 
     326                                        if (0 < currentDepth) 
     327                                                subMenuTitle.show(); 
     328                                        else 
     329                                                subMenuTitle.hide(); 
    310330 
    311331                                        // Update depth classes 
    312332                                        if( depthChange != 0 ) { 
     
    461481                                if( '' == $t.val() ) 
    462482                                        $t.addClass( name ).val( $t.data(name) ); 
    463483                        }); 
     484                         
     485                        $('.blank-slate .input-with-default-title').focus(); 
    464486                }, 
    465487 
    466488                attachThemeLocationsListeners : function() { 
     
    572594                        $.post( ajaxurl, params, function(menuMarkup) { 
    573595                                var ins = $('#menu-instructions'); 
    574596                                processMethod(menuMarkup, params); 
     597                                // Make it stand out a bit more visually, by adding a fadeIn 
     598                                $('li.pending').hide().fadeIn('slow'); 
     599                                $('.drag-instructions').show(); 
    575600                                if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length ) 
    576601                                        ins.addClass('menu-instructions-inactive'); 
    577602                                callback(); 
     
    945970                                        var ins = $('#menu-instructions'); 
    946971                                        el.remove(); 
    947972                                        children.shiftDepthClass(-1).updateParentMenuItemDBId(); 
    948                                         if( ! ins.siblings().length ) 
     973                                        if( 0 == $('#menu-to-edit li').length ) { 
     974                                                $('.drag-instructions').hide(); 
    949975                                                ins.removeClass('menu-instructions-inactive'); 
     976                                        } 
    950977                                }); 
    951978                }, 
    952979 
  • wp-admin/nav-menus.php

     
    531531                                <form id="update-nav-menu" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data"> 
    532532                                        <div id="nav-menu-header"> 
    533533                                                <div id="submitpost" class="submitbox"> 
    534                                                         <div class="major-publishing-actions"> 
     534                                                        <div class="major-publishing-actions <?php if ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] || empty( $nav_menus ) ) echo 'blank-slate'; ?>"> 
    535535                                                                <label class="menu-name-label howto open-label" for="menu-name"> 
    536536                                                                        <span><?php _e('Menu Name'); ?></span> 
    537537                                                                        <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Enter menu name here'); ?>" value="<?php echo esc_attr( $nav_menu_selected_title ); ?>" /> 
     
    574574                                        <div id="post-body"> 
    575575                                                <div id="post-body-content"> 
    576576                                                        <?php 
    577                                                         if ( isset( $edit_markup ) ) { 
     577                                                        $drag_instructions = ''; 
     578                                                        if ( empty( $ordered_menu_items ) ) 
     579                                                                $drag_instructions = 'style="display: none;"'; 
     580                                                         
     581                                                        if ( isset( $edit_markup ) ) {                                                           
     582                                                                echo '<div class="drag-instructions post-body-plain" ' . $drag_instructions . '>'; 
     583                                                                echo '<p>' . __('Drag each item into the order you prefer. Click an item to reveal additional configuration options.') . '</p>'; 
     584                                                                echo '</div>'; 
     585                                                                 
    578586                                                                if ( ! is_wp_error( $edit_markup ) ) 
    579587                                                                        echo $edit_markup; 
    580588                                                        } else if ( empty( $nav_menu_selected_id ) ) { 
    581589                                                                echo '<div class="post-body-plain">'; 
    582                                                                 echo '<p>' . __('To create a custom menu, give it a name above and click Create Menu. Then choose items like pages, categories or custom links from the left column to add to this menu.') . '</p>'; 
    583                                                                 echo '<p>' . __('After you have added your items, drag and drop to put them in the order you want. You can also click each item to reveal additional configuration options.') . '</p>'; 
    584                                                                 echo '<p>' . __('When you have finished building your custom menu, make sure you click the Save Menu button.') . '</p>'; 
     590                                                                echo '<p>' . __('Give your custom menu a name above, then click Create Menu.') . '</p>'; 
    585591                                                                echo '</div>'; 
    586592                                                        } 
    587593                                                        ?> 
  • wp-admin/css/wp-admin.css

     
    67856785        position: relative; 
    67866786} 
    67876787 
     6788.blank-slate br {  
     6789        display: none;  
     6790}  
     6791 
     6792.blank-slate .menu-name {  
     6793        height: 2em;  
     6794} 
     6795 
     6796.is-submenu { 
     6797        color: #999; 
     6798        font-style: italic; 
     6799        font-weight: normal; 
     6800        margin-left: 4px; 
     6801} 
     6802 
    67886803/* Menu Container */ 
    67896804#menu-management-liquid { 
    67906805        float: left; 
     
    70807095} 
    70817096 
    70827097#menu-to-edit { 
    7083         padding: 1em 0; 
     7098        padding: 0.1em 0; 
    70847099} 
    70857100 
    70867101.menu ul { 
     
    73267341        margin: 5px 0 1px; 
    73277342} 
    73287343 
     7344.nav-menus-php .blank-slate .publishing-action {  
     7345        float: left;  
     7346        margin: 1px 0 0;  
     7347} 
     7348 
    73297349.nav-menus-php .major-publishing-actions .delete-action { 
    73307350        vertical-align: middle; 
    73317351        text-align: left;