Ticket #23119: 23119.31.diff

File 23119.31.diff, 61.6 KB (added by lessbloat, 3 months ago)
Line 
1Index: wp-admin/includes/nav-menu.php
2===================================================================
3--- wp-admin/includes/nav-menu.php      (revision 23402)
4+++ wp-admin/includes/nav-menu.php      (working copy)
5@@ -81,11 +81,15 @@
6 
7                $title = empty( $item->label ) ? $title : $item->label;
8 
9+               $submenu_text = '';
10+               if ( 0 == $depth )
11+                       $submenu_text = 'style="display: none;"';
12+
13                ?>
14                <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>">
15                        <dl class="menu-item-bar">
16                                <dt class="menu-item-handle">
17-                                       <span class="item-title"><?php echo esc_html( $title ); ?></span>
18+                                       <span class="item-title"><?php echo esc_html( $title ); ?> <span class="is-submenu" <?php echo $submenu_text; ?>><?php _e( 'sub item' ); ?></span></span>
19                                        <span class="item-controls">
20                                                <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
21                                                <span class="item-order hide-if-js">
22@@ -182,10 +186,10 @@
23                                                                'action' => 'delete-menu-item',
24                                                                'menu-item' => $item_id,
25                                                        ),
26-                                                       remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
27+                                                       admin_url( 'nav-menus.php' )
28                                                ),
29                                                'delete-menu_item_' . $item_id
30-                                       ); ?>"><?php _e('Remove'); ?></a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url( add_query_arg( array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) ) );
31+                                       ); ?>"><?php _e( 'Remove' ); ?></a> <span class="meta-sep hide-if-no-js"> | </span> <a class="item-cancel submitcancel hide-if-no-js" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url( add_query_arg( array( 'edit-menu-item' => $item_id, 'cancel' => time() ), admin_url( 'nav-menus.php' ) ) );
32                                                ?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a>
33                                </div>
34 
35@@ -382,10 +386,8 @@
36  **/
37 function wp_nav_menu_setup() {
38        // Register meta boxes
39-       if ( wp_get_nav_menus() )
40-               add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
41-       add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
42        wp_nav_menu_post_type_meta_boxes();
43+       add_meta_box( 'add-custom-links', __( 'Add Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
44        wp_nav_menu_taxonomy_meta_boxes();
45 
46        // Register advanced menu items (columns)
47@@ -411,7 +413,7 @@
48        if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) )
49                return;
50 
51-       $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-custom-links', 'add-page', 'add-category' );
52+       $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category' );
53        $hidden_meta_boxes = array();
54 
55        foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
56@@ -445,7 +447,7 @@
57                $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
58                if ( $post_type ) {
59                        $id = $post_type->name;
60-                       add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
61+                       add_meta_box( "add-{$id}", sprintf( _x( 'Add %s', 'post type label name' ), $post_type->labels->name ), 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
62                }
63        }
64 }
65@@ -465,7 +467,7 @@
66                $tax = apply_filters( 'nav_menu_meta_box_object', $tax );
67                if ( $tax ) {
68                        $id = $tax->name;
69-                       add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
70+                       add_meta_box( "add-{$id}", sprintf( _x( 'Add %s', 'taxonomy label name' ), $tax->labels->name ), 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
71                }
72        }
73 }
74@@ -489,7 +491,7 @@
75        $menu_locations = get_nav_menu_locations();
76        $num_locations = count( array_keys($locations) );
77 
78-       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>';
79+       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>';
80 
81        foreach ( $locations as $location => $description ) {
82                ?>
83@@ -512,13 +514,33 @@
84        }
85        ?>
86        <p class="button-controls">
87-               <?php submit_button( __( 'Save' ), 'primary right', 'nav-menu-locations', false, disabled( $nav_menu_selected_id, 0, false ) ); ?>
88+               <?php submit_button( __( 'Save' ), 'primary right', 'nav-menu-locations', false, wp_nav_menu_disabled_check( $nav_menu_selected_id ) ); ?>
89                <span class="spinner"></span>
90        </p>
91        <?php
92 }
93 
94 /**
95+ * Check whether to disable the Menu Locations meta box submit button
96+ *
97+ * @since 3.6.0
98+ *
99+ * @uses global $one_theme_location_no_menus to determine if no menus exist
100+ * @uses disabled() to output the disabled attribute in $other_attributes param in submit_button()
101+ *
102+ * @param int|string $nav_menu_selected_id (id, name or slug) of the currently-selected menu
103+ * @return string Disabled attribute if at least one menu exists, false if not
104+*/
105+function wp_nav_menu_disabled_check( $nav_menu_selected_id ) {
106+       global $one_theme_location_no_menus;
107+
108+       if ( $one_theme_location_no_menus )
109+               return false;
110+
111+       return disabled( $nav_menu_selected_id, 0 );
112+}
113+
114+/**
115  * Displays a metabox for the custom links menu item.
116  *
117  * @since 3.0.0
118@@ -554,14 +576,14 @@
119 
120                        <p id="menu-item-name-wrap">
121                                <label class="howto" for="custom-menu-item-name">
122-                                       <span><?php _e('Label'); ?></span>
123+                                       <span><?php _e( 'Link Text' ); ?></span>
124                                        <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" />
125                                </label>
126                        </p>
127 
128                <p class="button-controls">
129                        <span class="add-to-menu">
130-                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
131+                               <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
132                                <span class="spinner"></span>
133                        </span>
134                </p>
135@@ -768,18 +790,18 @@
136                <p class="button-controls">
137                        <span class="list-controls">
138                                <a href="<?php
139-                                       echo esc_url(add_query_arg(
140+                                       echo esc_url( add_query_arg(
141                                                array(
142                                                        $post_type_name . '-tab' => 'all',
143                                                        'selectall' => 1,
144                                                ),
145-                                               remove_query_arg($removed_args)
146+                                               remove_query_arg( $removed_args )
147                                        ));
148                                ?>#posttype-<?php echo $post_type_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
149                        </span>
150 
151                        <span class="add-to-menu">
152-                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />
153+                               <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-' . $post_type_name ); ?>" />
154                                <span class="spinner"></span>
155                        </span>
156                </p>
157@@ -955,7 +977,7 @@
158                        </span>
159 
160                        <span class="add-to-menu">
161-                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />
162+                               <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-taxonomy-menu-item" id="<?php esc_attr_e( 'submit-taxonomy-' . $taxonomy_name ); ?>" />
163                                <span class="spinner"></span>
164                        </span>
165                </p>
166@@ -1086,7 +1108,7 @@
167                $menu_items = wp_get_nav_menu_items( $menu->term_id, array('post_status' => 'any') );
168                $result = '<div id="menu-instructions" class="post-body-plain';
169                $result .= ( ! empty($menu_items) ) ? ' menu-instructions-inactive">' : '">';
170-               $result .= '<p>' . __('Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu.') . '</p>';
171+               $result .= '<p>' . __( 'Next, add menu items (i.e. pages, links, categories) from the column on the left.' ) . '</p>';
172                $result .= '</div>';
173 
174                if( empty($menu_items) )
175@@ -1158,5 +1180,118 @@
176        foreach( (array) $menu_items_to_delete as $menu_item_id )
177                wp_delete_post( $menu_item_id, true );
178 }
179+add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
180 
181-add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
182+/**
183+ * Delete nav menus from the nav menu management screen
184+ *
185+ * @since 3.6.0
186+ * @access private
187+ *
188+ * @param int|string $nav_menu_id The menu to delete (id, slug, or name)
189+ * @return false if Error, otherwise true
190+ */
191+function _wp_delete_nav_menu( $nav_menu_id ) {
192+
193+       if ( ! is_nav_menu( $nav_menu_id ) )
194+               return;
195+
196+       $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_id );
197+       $delete_nav_menu = wp_delete_nav_menu( $nav_menu_id );
198+
199+       if ( is_wp_error( $delete_nav_menu ) )
200+               return $delete_nav_menu;
201+
202+       // Remove this menu from any locations.
203+       $locations = get_theme_mod( 'nav_menu_locations' );
204+       foreach ( (array) $locations as $location => $menu_id ) {
205+               if ( $menu_id == $nav_menu_id )
206+                       $locations[ $location ] = 0;
207+       }
208+       set_theme_mod( 'nav_menu_locations', $locations );
209+       return true;
210+}
211+
212+/**
213+ * Saves nav menu items
214+ *
215+ * @since 3.6.0
216+ *
217+ * @uses wp_get_nav_menu_items() to retrieve the nav menu's menu items
218+ * @uses wp_defer_term_counter() to enable then disable term counting
219+ *
220+ * @param int|string $nav_menu_selected_id (id, slug, or name ) of the currently-selected menu
221+ * @param string $nav_menu_selected_title Title of the currently-selected menu
222+ * @return array $messages The menu updated message
223+ */
224+function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_selected_title ) {
225+       $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish' ) );
226+
227+       $menu_items = array();
228+       // Index menu items by db ID
229+       foreach ( $unsorted_menu_items as $_item )
230+               $menu_items[$_item->db_id] = $_item;
231+
232+       $post_fields = array(
233+               'menu-item-db-id', 'menu-item-object-id', 'menu-item-object',
234+               'menu-item-parent-id', 'menu-item-position', 'menu-item-type',
235+               'menu-item-title', 'menu-item-url', 'menu-item-description',
236+               'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn'
237+       );
238+
239+       wp_defer_term_counting( true );
240+       // Loop through all the menu items' POST variables
241+       if ( ! empty( $_POST['menu-item-db-id'] ) ) {
242+               foreach( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
243+
244+                       // Menu item title can't be blank
245+                       if ( empty( $_POST['menu-item-title'][$_key] ) )
246+                               continue;
247+
248+                       $args = array();
249+                       foreach ( $post_fields as $field )
250+                               $args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
251+
252+                       $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
253+
254+                       if ( is_wp_error( $menu_item_db_id ) )
255+                               $messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>';
256+                       elseif ( isset( $menu_items[$menu_item_db_id] ) )
257+                               unset( $menu_items[$menu_item_db_id] );
258+               }
259+       }
260+
261+       // Remove menu items from the menu that weren't in $_POST
262+       if ( ! empty( $menu_items ) ) {
263+               foreach ( array_keys( $menu_items ) as $menu_item_id ) {
264+                       if ( is_nav_menu_item( $menu_item_id ) ) {
265+                               wp_delete_post( $menu_item_id );
266+                       }
267+               }
268+       }
269+
270+       // Store 'auto-add' pages.
271+       $auto_add = ! empty( $_POST['auto-add-pages'] );
272+       $nav_menu_option = (array) get_option( 'nav_menu_options' );
273+       if ( ! isset( $nav_menu_option['auto_add'] ) )
274+               $nav_menu_option['auto_add'] = array();
275+       if ( $auto_add ) {
276+               if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
277+                       $nav_menu_option['auto_add'][] = $nav_menu_selected_id;
278+       } else {
279+               if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
280+                       unset( $nav_menu_option['auto_add'][$key] );
281+       }
282+       // Remove nonexistent/deleted menus
283+       $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
284+       update_option( 'nav_menu_options', $nav_menu_option );
285+
286+       wp_defer_term_counting( false );
287+
288+       do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
289+
290+       $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%1$s</strong> has been updated.' ), $nav_menu_selected_title ) . '</p></div>';
291+       unset( $menu_items, $unsorted_menu_items );
292+
293+       return $messages;
294+}
295Index: wp-admin/js/nav-menu.js
296===================================================================
297--- wp-admin/js/nav-menu.js     (revision 23402)
298+++ wp-admin/js/nav-menu.js     (working copy)
299@@ -45,9 +45,14 @@
300                        if( api.menuList.length ) // If no menu, we're in the + tab.
301                                this.initSortables();
302 
303+                       if( oneThemeLocationNoMenus )
304+                               $( '#posttype-page' ).addSelectedToMenu( api.addMenuItemToBottom );
305+
306+                       this.messageFadeIn();
307+
308+                       this.initAccessibility();
309+
310                        this.initToggles();
311-
312-                       this.initTabManager();
313                },
314 
315                jQueryExtensions : function() {
316@@ -84,19 +89,55 @@
317                                        });
318                                        return result;
319                                },
320+                               shiftHorizontally : function( dir ) {
321+                                       return this.each(function(){
322+                                               var t = $(this),
323+                                                       depth = t.menuItemDepth(),
324+                                                       newDepth = depth + dir;
325+
326+                                               // Change .menu-item-depth-n class
327+                                               t.moveHorizontally( newDepth, depth );
328+                                       });
329+                               },
330+                               moveHorizontally : function( newDepth, depth ) {
331+                                       return this.each(function(){
332+                                               var t = $(this),
333+                                                       children = t.childMenuItems(),
334+                                                       diff = newDepth - depth,
335+                                                       subItemText = t.find('.is-submenu');
336+
337+                                               // Change .menu-item-depth-n class
338+                                               t.updateDepthClass( newDepth, depth ).updateParentMenuItemDBId();
339+
340+                                               // If it has children, move those too
341+                                               if ( children ) {
342+                                                       children.each(function( index ) {
343+                                                               var t = $(this),
344+                                                                       thisDepth = t.menuItemDepth(),
345+                                                                       newDepth = thisDepth + diff;
346+                                                               t.updateDepthClass(newDepth, thisDepth).updateParentMenuItemDBId();
347+                                                       });
348+                                               }
349+
350+                                               // Show "Sub item" helper text
351+                                               if (0 === newDepth)
352+                                                       subItemText.hide();
353+                                               else
354+                                                       subItemText.show();
355+                                       });
356+                               },
357                                updateParentMenuItemDBId : function() {
358                                        return this.each(function(){
359                                                var item = $(this),
360-                                                       input = item.find('.menu-item-data-parent-id'),
361-                                                       depth = item.menuItemDepth(),
362-                                                       parent = item.prev();
363+                                                       input = item.find( '.menu-item-data-parent-id' ),
364+                                                       depth = parseInt( item.menuItemDepth() ),
365+                                                       parentDepth = depth - 1,
366+                                                       parent = item.prevAll( '.menu-item-depth-' + parentDepth ).first();
367 
368-                                               if( depth == 0 ) { // Item is on the top level, has no parent
369+                                               if ( 0 == depth ) { // Item is on the top level, has no parent
370                                                        input.val(0);
371                                                } else { // Find the parent item, and retrieve its object id.
372-                                                       while( ! parent[0] || ! parent[0].className || -1 == parent[0].className.indexOf('menu-item') || ( parent.menuItemDepth() != depth - 1 ) )
373-                                                               parent = parent.prev();
374-                                                       input.val( parent.find('.menu-item-data-db-id').val() );
375+                                                       input.val( parent.find( '.menu-item-data-db-id' ).val() );
376                                                }
377                                        });
378                                },
379@@ -120,7 +161,7 @@
380 
381                                        return this.each(function() {
382                                                var t = $(this), menuItems = {},
383-                                                       checkboxes = t.find('.tabs-panel-active .categorychecklist li input:checked'),
384+                                                       checkboxes = ( oneThemeLocationNoMenus && 0 == t.find('.tabs-panel-active .categorychecklist li input:checked').length ) ? t.find('#page-all li input[type="checkbox"]') : t.find('.tabs-panel-active .categorychecklist li input:checked'),
385                                                        re = new RegExp('menu-item\\[(\[^\\]\]*)');
386 
387                                                processMethod = processMethod || api.addMenuItemToBottom;
388@@ -223,6 +264,128 @@
389                        });
390                },
391 
392+               initAccessibility : function() {
393+                       $( '.item-edit' ).off( 'focus' ).on( 'focus', function(){
394+                               $(this).on( 'keydown', function(e){
395+
396+                                       var $this = $(this);
397+
398+                                       // Bail if it's not an arrow key
399+                                       if ( 37 != e.which && 38 != e.which && 39 != e.which && 40 != e.which )
400+                                               return;
401+
402+                                       // Avoid multiple keydown events
403+                                       $this.off('keydown');
404+
405+                                       var menuItems = $('#menu-to-edit li');
406+                                               menuItemsCount = menuItems.length,
407+                                               thisItem = $this.parents( 'li.menu-item' ),
408+                                               thisItemChildren = thisItem.childMenuItems(),
409+                                               thisItemData = thisItem.getItemData(),
410+                                               thisItemDepth = parseInt( thisItem.menuItemDepth() ),
411+                                               thisItemPosition = parseInt( thisItem.index() ),
412+                                               nextItem = thisItem.next(),
413+                                               nextItemChildren = nextItem.childMenuItems(),
414+                                               nextItemDepth = parseInt( nextItem.menuItemDepth() ) + 1,
415+                                               prevItem = thisItem.prev(),
416+                                               prevItemDepth = parseInt( prevItem.menuItemDepth() ),
417+                                               prevItemId = prevItem.getItemData()['menu-item-db-id'];
418+
419+                                       // Bail if there is only one menu item
420+                                       if ( 1 === menuItemsCount )
421+                                               return;
422+
423+                                       // If RTL, swap left/right arrows
424+                                       var arrows = { '38' : 'up', '40' : 'down', '37' : 'left', '39' : 'right' };
425+                                       if ( $('body').hasClass('rtl') )
426+                                               arrows = { '38' : 'up', '40' : 'down', '39' : 'left', '37' : 'right' };
427+
428+                                       switch ( arrows[e.which] ) {
429+                                       case 'up':
430+                                               var newItemPosition = thisItemPosition - 1;
431+
432+                                               // Already at top
433+                                               if ( 0 === thisItemPosition )
434+                                                       break;
435+
436+                                               // If a sub item is moved to top, shift it to 0 depth
437+                                               if ( 0 === newItemPosition && 0 !== thisItemDepth )
438+                                                       thisItem.moveHorizontally( 0, thisItemDepth );
439+
440+                                               // If prev item is sub item, shift to match depth
441+                                               if ( 0 !== prevItemDepth )
442+                                                       thisItem.moveHorizontally( prevItemDepth, thisItemDepth );
443+
444+                                               // Does this item have sub items?
445+                                               if ( thisItemChildren ) {
446+                                                       var items = thisItem.add( thisItemChildren );
447+                                                       // Move the entire block
448+                                                       items.detach().insertBefore( menuItems.eq( newItemPosition ) );
449+                                               } else {
450+                                                       thisItem.detach().insertBefore( menuItems.eq( newItemPosition ) );
451+                                               }
452+                                               break;
453+                                       case 'down':
454+                                               // Does this item have sub items?
455+                                               if ( thisItemChildren ) {
456+                                                       var items = thisItem.add( thisItemChildren ),
457+                                                               nextItem = menuItems.eq( items.length + thisItemPosition ),
458+                                                               nextItemChildren = 0 !== nextItem.childMenuItems().length;
459+
460+                                                       if ( nextItemChildren ) {
461+                                                               var newDepth = parseInt( nextItem.menuItemDepth() ) + 1;
462+                                                               thisItem.moveHorizontally( newDepth, thisItemDepth );
463+                                                       }
464+
465+                                                       // Have we reached the bottom?
466+                                                       if ( menuItemsCount === thisItemPosition + items.length )
467+                                                               break;
468+
469+                                                       items.detach().insertAfter( menuItems.eq( thisItemPosition + items.length ) );
470+                                               } else {
471+                                                       // If next item has sub items, shift depth
472+                                                       if ( 0 !== nextItemChildren.length )
473+                                                               thisItem.moveHorizontally( nextItemDepth, thisItemDepth );
474+
475+                                                       // Have we reached the bottom
476+                                                       if ( menuItemsCount === thisItemPosition + 1 )
477+                                                               break;
478+                                                       thisItem.detach().insertAfter( menuItems.eq( thisItemPosition + 1 ) );
479+                                               }
480+                                               break;
481+                                       case 'left':
482+                                               // As far left as possible
483+                                               if ( 0 === thisItemDepth )
484+                                                       break;
485+                                               thisItem.shiftHorizontally( -1 );
486+                                               break;
487+                                       case 'right':
488+                                               // Can't be sub item at top
489+                                               if ( 0 === thisItemPosition )
490+                                                       break;
491+                                               // Already sub item of prevItem
492+                                               if ( thisItemData['menu-item-parent-id'] === prevItemId )
493+                                                       break;
494+                                               thisItem.shiftHorizontally( 1 );
495+                                               break;
496+                                       }
497+                                       api.registerChange();
498+                                       // Put focus back on same menu item
499+                                       $( '#edit-' + thisItemData['menu-item-db-id'] ).focus();
500+                                       return false;
501+                               });
502+                       }).blur(function () {
503+                               $(this).off( 'keydown' );
504+                       });
505+               },
506+
507+               messageFadeIn : function() {
508+                       var messages = $( '#message' );
509+
510+                       // Visual change when users save menus multiple times in a row
511+                       messages.slideDown( 'slow' );
512+               },
513+
514                initToggles : function() {
515                        // init postboxes
516                        postboxes.add_postbox_toggles('nav-menus');
517@@ -246,6 +409,9 @@
518                                body = $('body'), maxChildDepth,
519                                menuMaxDepth = initialMenuMaxDepth();
520 
521+                       if( 0 != $( '#menu-to-edit li' ).length )
522+                               $( '.drag-instructions' ).show();
523+
524                        // Use the right edge if RTL.
525                        menuEdge += api.isRTL ? api.menuList.width() : 0;
526 
527@@ -308,6 +474,13 @@
528                                        // Return child elements to the list
529                                        children = transport.children().insertAfter(ui.item);
530 
531+                                       // Add "sub menu" description
532+                                       var subMenuTitle = ui.item.find( '.item-title .is-submenu' );
533+                                       if ( 0 < currentDepth )
534+                                               subMenuTitle.show();
535+                                       else
536+                                               subMenuTitle.hide();
537+
538                                        // Update depth classes
539                                        if( depthChange != 0 ) {
540                                                ui.item.updateDepthClass( currentDepth );
541@@ -327,9 +500,6 @@
542                                                ui.item[0].style.left = 'auto';
543                                                ui.item[0].style.right = 0;
544                                        }
545-
546-                                       // The width of the tab bar might have changed. Just in case.
547-                                       api.refreshMenuTabs( true );
548                                },
549                                change: function(e, ui) {
550                                        // Make sure the placeholder is inside the menu.
551@@ -461,6 +631,8 @@
552                                if( '' == $t.val() )
553                                        $t.addClass( name ).val( $t.data(name) );
554                        });
555+
556+                       $( '.blank-slate .input-with-default-title' ).focus();
557                },
558 
559                attachThemeLocationsListeners : function() {
560@@ -572,8 +744,11 @@
561                        $.post( ajaxurl, params, function(menuMarkup) {
562                                var ins = $('#menu-instructions');
563                                processMethod(menuMarkup, params);
564-                               if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length )
565-                                       ins.addClass('menu-instructions-inactive');
566+                               // Make it stand out a bit more visually, by adding a fadeIn
567+                               $( 'li.pending' ).hide().fadeIn('slow');
568+                               $( '.drag-instructions' ).show();
569+                               if( ! ins.hasClass( 'menu-instructions-inactive' ) && ins.siblings().length )
570+                                       ins.addClass( 'menu-instructions-inactive' );
571                                callback();
572                        });
573                },
574@@ -586,10 +761,12 @@
575                 */
576                addMenuItemToBottom : function( menuMarkup, req ) {
577                        $(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
578+                       api.initAccessibility();
579                },
580 
581                addMenuItemToTop : function( menuMarkup, req ) {
582                        $(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
583+                       api.initAccessibility();
584                },
585 
586                attachUnsavedChangesListener : function() {
587@@ -604,7 +781,7 @@
588                                };
589                        } else {
590                                // Make the post boxes read-only, as they can't be used yet
591-                               $('#menu-settings-column').find('input,select').prop('disabled', true).end().find('a').attr('href', '#').unbind('click');
592+                               $( '#menu-settings-column' ).find( 'input,select' ).end().find( 'a' ).attr( 'href', '#' ).unbind( 'click' );
593                        }
594                },
595 
596@@ -688,139 +865,6 @@
597                        });
598                },
599 
600-               initTabManager : function() {
601-                       var fixed = $('.nav-tabs-wrapper'),
602-                               fluid = fixed.children('.nav-tabs'),
603-                               active = fluid.children('.nav-tab-active'),
604-                               tabs = fluid.children('.nav-tab'),
605-                               tabsWidth = 0,
606-                               fixedRight, fixedLeft,
607-                               arrowLeft, arrowRight, resizeTimer, css = {},
608-                               marginFluid = api.isRTL ? 'margin-right' : 'margin-left',
609-                               marginFixed = api.isRTL ? 'margin-left' : 'margin-right',
610-                               msPerPx = 2;
611-
612-                       /**
613-                        * Refreshes the menu tabs.
614-                        * Will show and hide arrows where necessary.
615-                        * Scrolls to the active tab by default.
616-                        *
617-                        * @param savePosition {boolean} Optional. Prevents scrolling so
618-                        *                that the current position is maintained. Default false.
619-                        **/
620-                       api.refreshMenuTabs = function( savePosition ) {
621-                               var fixedWidth = fixed.width(),
622-                                       margin = 0, css = {};
623-                               fixedLeft = fixed.offset().left;
624-                               fixedRight = fixedLeft + fixedWidth;
625-
626-                               if( !savePosition )
627-                                       active.makeTabVisible();
628-
629-                               // Prevent space from building up next to the last tab if there's more to show
630-                               if( tabs.last().isTabVisible() ) {
631-                                       margin = fixed.width() - tabsWidth;
632-                                       margin = margin > 0 ? 0 : margin;
633-                                       css[marginFluid] = margin + 'px';
634-                                       fluid.animate( css, 100, "linear" );
635-                               }
636-
637-                               // Show the arrows only when necessary
638-                               if( fixedWidth > tabsWidth )
639-                                       arrowLeft.add( arrowRight ).hide();
640-                               else
641-                                       arrowLeft.add( arrowRight ).show();
642-                       }
643-
644-                       $.fn.extend({
645-                               makeTabVisible : function() {
646-                                       var t = this.eq(0), left, right, css = {}, shift = 0;
647-
648-                                       if( ! t.length ) return this;
649-
650-                                       left = t.offset().left;
651-                                       right = left + t.outerWidth();
652-
653-                                       if( right > fixedRight )
654-                                               shift = fixedRight - right;
655-                                       else if ( left < fixedLeft )
656-                                               shift = fixedLeft - left;
657-
658-                                       if( ! shift ) return this;
659-
660-                                       css[marginFluid] = "+=" + api.negateIfRTL * shift + 'px';
661-                                       fluid.animate( css, Math.abs( shift ) * msPerPx, "linear" );
662-                                       return this;
663-                               },
664-                               isTabVisible : function() {
665-                                       var t = this.eq(0),
666-                                               left = t.offset().left,
667-                                               right = left + t.outerWidth();
668-                                       return ( right <= fixedRight && left >= fixedLeft ) ? true : false;
669-                               }
670-                       });
671-
672-                       // Find the width of all tabs
673-                       tabs.each(function(){
674-                               tabsWidth += $(this).outerWidth(true);
675-                       });
676-
677-                       // Set up fixed margin for overflow, unset padding
678-                       css['padding'] = 0;
679-                       css[marginFixed] = (-1 * tabsWidth) + 'px';
680-                       fluid.css( css );
681-
682-                       // Build tab navigation
683-                       arrowLeft = $('<div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div>');
684-                       arrowRight = $('<div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div>');
685-                       // Attach to the document
686-                       fixed.wrap('<div class="nav-tabs-nav"/>').parent().prepend( arrowLeft ).append( arrowRight );
687-
688-                       // Set the menu tabs
689-                       api.refreshMenuTabs();
690-                       // Make sure the tabs reset on resize
691-                       $(window).resize(function() {
692-                               if( resizeTimer ) clearTimeout(resizeTimer);
693-                               resizeTimer = setTimeout( api.refreshMenuTabs, 200);
694-                       });
695-
696-                       // Build arrow functions
697-                       $.each([{
698-                                       arrow : arrowLeft,
699-                                       next : "next",
700-                                       last : "first",
701-                                       operator : "+="
702-                               },{
703-                                       arrow : arrowRight,
704-                                       next : "prev",
705-                                       last : "last",
706-                                       operator : "-="
707-                               }], function(){
708-                               var that = this;
709-                               this.arrow.mousedown(function(){
710-                                       var marginFluidVal = Math.abs( parseInt( fluid.css(marginFluid) ) ),
711-                                               shift = marginFluidVal,
712-                                               css = {};
713-
714-                                       if( "-=" == that.operator )
715-                                               shift = Math.abs( tabsWidth - fixed.width() ) - marginFluidVal;
716-
717-                                       if( ! shift ) return;
718-
719-                                       css[marginFluid] = that.operator + shift + 'px';
720-                                       fluid.animate( css, shift * msPerPx, "linear" );
721-                               }).mouseup(function(){
722-                                       var tab, next;
723-                                       fluid.stop(true);
724-                                       tab = tabs[that.last]();
725-                                       while( (next = tab[that.next]()) && next.length && ! next.isTabVisible() ) {
726-                                               tab = next;
727-                                       }
728-                                       tab.makeTabVisible();
729-                               });
730-                       });
731-               },
732-
733                eventOnClickEditLink : function(clickedEl) {
734                        var settings, item,
735                        matchedSection = /#(.*)$/.exec(clickedEl.href);
736@@ -846,8 +890,10 @@
737                },
738 
739                eventOnClickCancelLink : function(clickedEl) {
740-                       var settings = $(clickedEl).closest('.menu-item-settings');
741-                       settings.setItemData( settings.data('menu-item-data') );
742+                       var settings = $( clickedEl ).closest( '.menu-item-settings' ),
743+                               thisMenuItem = $( clickedEl ).closest( '.menu-item' );
744+                       thisMenuItem.removeClass('menu-item-edit-active').addClass('menu-item-edit-inactive');
745+                       settings.setItemData( settings.data('menu-item-data') ).hide();
746                        return false;
747                },
748 
749@@ -944,9 +990,11 @@
750                                }, 350, function() {
751                                        var ins = $('#menu-instructions');
752                                        el.remove();
753-                                       children.shiftDepthClass(-1).updateParentMenuItemDBId();
754-                                       if( ! ins.siblings().length )
755-                                               ins.removeClass('menu-instructions-inactive');
756+                                       children.shiftDepthClass( -1 ).updateParentMenuItemDBId();
757+                                       if( 0 == $( '#menu-to-edit li' ).length ) {
758+                                               $( '.drag-instructions' ).hide();
759+                                               ins.removeClass( 'menu-instructions-inactive' );
760+                                       }
761                                });
762                },
763 
764Index: wp-admin/nav-menus.php
765===================================================================
766--- wp-admin/nav-menus.php      (revision 23402)
767+++ wp-admin/nav-menus.php      (working copy)
768@@ -221,50 +221,65 @@
769                if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) )
770                        $messages[] = '<div id="message" class="updated"><p>' . __('The menu item has been successfully deleted.') . '</p></div>';
771                break;
772+
773        case 'delete':
774                check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
775-
776                if ( is_nav_menu( $nav_menu_selected_id ) ) {
777-                       $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_selected_id );
778-                       $delete_nav_menu = wp_delete_nav_menu( $nav_menu_selected_id );
779-
780-                       if ( is_wp_error($delete_nav_menu) ) {
781-                               $messages[] = '<div id="message" class="error"><p>' . $delete_nav_menu->get_error_message() . '</p></div>';
782-                       } else {
783-                               // Remove this menu from any locations.
784-                               $locations = get_theme_mod( 'nav_menu_locations' );
785-                               foreach ( (array) $locations as $location => $menu_id ) {
786-                                       if ( $menu_id == $nav_menu_selected_id )
787-                                               $locations[ $location ] = 0;
788-                               }
789-                               set_theme_mod( 'nav_menu_locations', $locations );
790-                               $messages[] = '<div id="message" class="updated"><p>' . __('The menu has been successfully deleted.') . '</p></div>';
791-                               // Select the next available menu
792-                               $nav_menu_selected_id = 0;
793-                               $_nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
794-                               foreach( $_nav_menus as $index => $_nav_menu ) {
795-                                       if ( strcmp( $_nav_menu->name, $deleted_nav_menu->name ) >= 0
796-                                        || $index == count( $_nav_menus ) - 1 ) {
797-                                               $nav_menu_selected_id = $_nav_menu->term_id;
798-                                               break;
799-                                       }
800-                               }
801-                       }
802-                       unset( $delete_nav_menu, $deleted_nav_menu, $_nav_menus );
803+                       $deletion = _wp_delete_nav_menu( $nav_menu_selected_id );
804                } else {
805                        // Reset the selected menu
806                        $nav_menu_selected_id = 0;
807                        unset( $_REQUEST['menu'] );
808                }
809+
810+               if ( ! isset( $deletion ) )
811+                       break;
812+
813+               if ( is_wp_error( $deletion ) )
814+                       $messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>';
815+               else
816+                       $messages[] = '<div id="message" class="updated"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>';
817                break;
818 
819+       case 'delete_menus':
820+               check_admin_referer( 'nav_menus_bulk_actions' );
821+               foreach ( $_REQUEST['delete_menus'] as $menu_id_to_delete ) {
822+                       if ( ! is_nav_menu( $menu_id_to_delete ) )
823+                               continue;
824+
825+                       $deletion = _wp_delete_nav_menu( $menu_id_to_delete );
826+                       if ( is_wp_error( $deletion ) ) {
827+                               $messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>';
828+                               $deletion_error = true;
829+                       }
830+               }
831+
832+               if ( empty( $deletion_error ) )
833+                       $messages[] = '<div id="message" class="updated"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>';
834+               break;
835+
836        case 'update':
837                check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
838 
839-               // Update menu theme locations
840-               if ( isset( $_POST['menu-locations'] ) )
841-                       set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
842+               // Get existing menu locations assignments
843+               $locations = get_registered_nav_menus();
844+               $menu_locations = get_nav_menu_locations();
845 
846+               // Remove menu locations that have been unchecked
847+               foreach ( $locations as $location => $description ) {
848+                       if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id )
849+                               unset( $menu_locations[ $location ] );
850+               }
851+
852+               // Merge new and existing menu locations if any new ones are set
853+               if ( isset( $_POST['menu-locations'] ) ) {
854+                       $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] );
855+                       $menu_locations = array_merge( $menu_locations, $new_menu_locations );
856+               }
857+
858+               // Set menu locations
859+               set_theme_mod( 'nav_menu_locations', $menu_locations );
860+
861                // Add Menu
862                if ( 0 == $nav_menu_selected_id ) {
863                        $new_menu_title = trim( esc_html( $_POST['menu-name'] ) );
864@@ -278,20 +293,33 @@
865                                        $_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
866                                        $nav_menu_selected_id = $_nav_menu_selected_id;
867                                        $nav_menu_selected_title = $_menu_object->name;
868-                                       $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been successfully created.'), $nav_menu_selected_title ) . '</p></div>';
869+                                       if ( isset( $_REQUEST['menu-item'] ) )
870+                                               wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) );
871+                                       if ( isset( $_REQUEST['zero-menu-state'] ) ) {
872+                                               // If there are menu items, add them
873+                                               wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title );
874+                                               // Auto-save nav_menu_locations
875+                                               $locations = get_theme_mod( 'nav_menu_locations' );
876+                                               foreach ( (array) $locations as $location => $menu_id ) {
877+                                                               $locations[ $location ] = $nav_menu_selected_id;
878+                                                               break; // There should only be 1
879+                                               }
880+                                               set_theme_mod( 'nav_menu_locations', $locations );
881+                                       }
882+                                       $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%s</strong> has been created.' ), $nav_menu_selected_title ) . '</p></div>';
883                                }
884                        } else {
885-                               $messages[] = '<div id="message" class="error"><p>' . __('Please enter a valid menu name.') . '</p></div>';
886+                               $messages[] = '<div id="message" class="error"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
887                        }
888 
889-               // update existing menu
890+               // Update existing menu
891                } else {
892 
893                        $_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
894 
895                        $menu_title = trim( esc_html( $_POST['menu-name'] ) );
896                        if ( ! $menu_title ) {
897-                               $messages[] = '<div id="message" class="error"><p>' . __('Please enter a valid menu name.') . '</p></div>';
898+                               $messages[] = '<div id="message" class="error"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
899                                $menu_title = $_menu_object->name;
900                        }
901 
902@@ -307,68 +335,8 @@
903                        }
904 
905                        // Update menu items
906-
907                        if ( ! is_wp_error( $_menu_object ) ) {
908-                               $unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish') );
909-                               $menu_items = array();
910-                               // Index menu items by db ID
911-                               foreach( $unsorted_menu_items as $_item )
912-                                       $menu_items[$_item->db_id] = $_item;
913-
914-                               $post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn' );
915-                               wp_defer_term_counting(true);
916-                               // Loop through all the menu items' POST variables
917-                               if ( ! empty( $_POST['menu-item-db-id'] ) ) {
918-                                       foreach( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
919-
920-                                               // Menu item title can't be blank
921-                                               if ( empty( $_POST['menu-item-title'][$_key] ) )
922-                                                       continue;
923-
924-                                               $args = array();
925-                                               foreach ( $post_fields as $field )
926-                                                       $args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
927-
928-                                               $menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
929-
930-                                               if ( is_wp_error( $menu_item_db_id ) )
931-                                                       $messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>';
932-                                               elseif ( isset( $menu_items[$menu_item_db_id] ) )
933-                                                       unset( $menu_items[$menu_item_db_id] );
934-                                       }
935-                               }
936-
937-                               // Remove menu items from the menu that weren't in $_POST
938-                               if ( ! empty( $menu_items ) ) {
939-                                       foreach ( array_keys( $menu_items ) as $menu_item_id ) {
940-                                               if ( is_nav_menu_item( $menu_item_id ) ) {
941-                                                       wp_delete_post( $menu_item_id );
942-                                               }
943-                                       }
944-                               }
945-
946-                               // Store 'auto-add' pages.
947-                               $auto_add = ! empty( $_POST['auto-add-pages'] );
948-                               $nav_menu_option = (array) get_option( 'nav_menu_options' );
949-                               if ( ! isset( $nav_menu_option['auto_add'] ) )
950-                                       $nav_menu_option['auto_add'] = array();
951-                               if ( $auto_add ) {
952-                                       if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
953-                                               $nav_menu_option['auto_add'][] = $nav_menu_selected_id;
954-                               } else {
955-                                       if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
956-                                               unset( $nav_menu_option['auto_add'][$key] );
957-                               }
958-                               // Remove nonexistent/deleted menus
959-                               $nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
960-                               update_option( 'nav_menu_options', $nav_menu_option );
961-
962-                               wp_defer_term_counting(false);
963-
964-                               do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
965-
966-                               $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been updated.'), $nav_menu_selected_title ) . '</p></div>';
967-                               unset( $menu_items, $unsorted_menu_items );
968+                               $messages = array_merge( $messages, wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) );
969                        }
970                }
971                break;
972@@ -376,23 +344,36 @@
973 
974 // Get all nav menus
975 $nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
976+$menu_count = count( $nav_menus );
977 
978-// Get recently edited nav menu
979-$recently_edited = (int) get_user_option( 'nav_menu_recently_edited' );
980+// Are we on the add new screen?
981+$add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false;
982 
983-// If there was no recently edited menu, and $nav_menu_selected_id is a nav menu, update recently edited menu.
984-if ( !$recently_edited && is_nav_menu( $nav_menu_selected_id ) ) {
985+// If we have one theme location, and zero menus, we take them right into editing their first menu
986+$page_count = wp_count_posts( 'page' );
987+$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false;
988+
989+// Redirect to add screen if there are no menus and this users has either zero, or more than 1 theme locations
990+if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus )
991+       wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) );
992+
993+// Get recently edited nav menu
994+$recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
995+if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) )
996        $recently_edited = $nav_menu_selected_id;
997 
998-// Else if $nav_menu_selected_id is not a menu and not requesting that we create a new menu, but $recently_edited is a menu, grab that one.
999-} elseif ( 0 == $nav_menu_selected_id && ! isset( $_REQUEST['menu'] ) && is_nav_menu( $recently_edited ) ) {
1000+// Use $recently_edited if none are selected
1001+if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) )
1002        $nav_menu_selected_id = $recently_edited;
1003 
1004-// Else try to grab the first menu from the menus list
1005-} elseif ( 0 == $nav_menu_selected_id && ! isset( $_REQUEST['menu'] ) && ! empty($nav_menus) ) {
1006+// On deletion of menu, if another menu exists, show it
1007+if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] )
1008        $nav_menu_selected_id = $nav_menus[0]->term_id;
1009-}
1010 
1011+// Set $nav_menu_selected_id to 0 if no menus
1012+if ( $one_theme_location_no_menus )
1013+       $nav_menu_selected_id = 0;
1014+
1015 // Update the user's setting
1016 if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) )
1017        update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id );
1018@@ -412,14 +393,22 @@
1019        $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name;
1020 }
1021 
1022+// Retrieve menu locations
1023+if ( current_theme_supports( 'menus' ) ) {
1024+       $locations = get_registered_nav_menus();
1025+       $menu_locations = get_nav_menu_locations();
1026+}
1027+
1028 // Ensure the user will be able to scroll horizontally
1029 // by adding a class for the max menu depth.
1030 global $_wp_nav_menu_max_depth;
1031 $_wp_nav_menu_max_depth = 0;
1032 
1033 // Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth
1034-if ( is_nav_menu( $nav_menu_selected_id ) )
1035+if ( is_nav_menu( $nav_menu_selected_id ) ) {
1036+       $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'post_status' => 'any' ) );
1037        $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id );
1038+}
1039 
1040 function wp_nav_menu_max_depth($classes) {
1041        global $_wp_nav_menu_max_depth;
1042@@ -460,15 +449,52 @@
1043 ?>
1044 <div class="wrap">
1045        <?php screen_icon(); ?>
1046-       <h2><?php esc_html_e('Menus'); ?></h2>
1047+       <h2><?php _e( 'Menus' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, ), admin_url( 'nav-menus.php' ) ) ); ?>" class="add-new-h2"><?php _e( 'Add New' ); ?></a></h2>
1048        <?php
1049        foreach( $messages as $message ) :
1050                echo $message . "\n";
1051        endforeach;
1052        ?>
1053+       <?php if ( 1 < $menu_count ) : ?>
1054+       <form method="post" action="<?php echo admin_url( 'nav-menus.php' ); ?>">
1055+               <input type="hidden" name="action" value="edit" />
1056+               <div class="manage-menus">
1057+                       <label for="menu" class="selected-menu"><?php _e('Select menu to edit'); ?></label>
1058+                       <select name="menu" id="menu">
1059+                               <?php if ( $add_new_screen ) : ?>
1060+                                       <option value="0" selected="selected"><?php _e( '-- Select --' ); ?></option>
1061+                               <?php endif; ?>
1062+                               <?php foreach( (array) $nav_menus as $_nav_menu ) : ?>
1063+                                       <option value="<?php echo esc_attr( $_nav_menu->term_id ); ?>" <?php selected( $_nav_menu->term_id, $nav_menu_selected_id ); ?>>
1064+                                               <?php
1065+                                               echo esc_html( $_nav_menu->truncated_name ) ;
1066+
1067+                                               if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
1068+                                                       $locations_assigned_to_this_menu = array();
1069+                                                       foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
1070+                                                                $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
1071+                                                       }
1072+                                                       $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
1073+
1074+                                                       // Adds ellipses following the number of locations defined in $assigned_locations
1075+                                                       printf( ' (%1$s%2$s)',
1076+                                                               implode( ', ', $assigned_locations ),
1077+                                                               count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' &hellip;' : ''
1078+                                                       );
1079+                                               }
1080+                                               ?>
1081+                                       </option>
1082+                               <?php endforeach; ?>
1083+                       </select>
1084+                       <span class="submit-btn"><input type="submit" class="button-secondary" value="<?php _e( 'Select' ); ?>"></span>
1085+               </div>
1086+       </form>
1087+       <?php endif; ?>
1088        <div id="nav-menus-frame">
1089-       <div id="menu-settings-column" class="metabox-holder<?php if ( !$nav_menu_selected_id ) { echo ' metabox-holder-disabled'; } ?>">
1090+       <div id="menu-settings-column" class="metabox-holder<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] ) { echo ' metabox-holder-disabled'; } ?>">
1091 
1092+               <div class="clear"></div>
1093+
1094                <form id="nav-menu-meta" action="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-menu-meta" method="post" enctype="multipart/form-data">
1095                        <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
1096                        <input type="hidden" name="action" value="add-menu-item" />
1097@@ -479,129 +505,100 @@
1098        </div><!-- /#menu-settings-column -->
1099        <div id="menu-management-liquid">
1100                <div id="menu-management">
1101-                       <div id="select-nav-menu-container" class="hide-if-js">
1102-                               <form id="select-nav-menu" action="">
1103-                                       <strong><label for="select-nav-menu"><?php esc_html_e( 'Select Menu:' ); ?></label></strong>
1104-                                       <select class="select-nav-menu" name="menu">
1105-                                               <?php foreach( (array) $nav_menus as $_nav_menu ) : ?>
1106-                                                       <option value="<?php echo esc_attr($_nav_menu->term_id) ?>" <?php selected($nav_menu_selected_id, $_nav_menu->term_id); ?>>
1107-                                                               <?php echo esc_html( $_nav_menu->truncated_name ); ?>
1108-                                                       </option>
1109-                                               <?php endforeach; ?>
1110-                                               <option value="0"><?php esc_html_e('Add New Menu'); ?></option>
1111-                                       </select>
1112-                                       <input type="hidden" name="action" value="edit" />
1113-                                       <?php submit_button( __( 'Select' ), 'secondary', 'select_menu', false ); ?>
1114-                               </form>
1115-                       </div>
1116-                       <div class="nav-tabs-wrapper">
1117-                       <div class="nav-tabs">
1118-                               <?php
1119-                               foreach( (array) $nav_menus as $_nav_menu ) :
1120-                                       if ( $nav_menu_selected_id == $_nav_menu->term_id ) : ?><span class="nav-tab nav-tab-active">
1121-                                                       <?php echo esc_html( $_nav_menu->truncated_name ); ?>
1122-                                               </span><?php else : ?><a href="<?php
1123-                                                       echo esc_url(add_query_arg(
1124-                                                               array(
1125-                                                                       'action' => 'edit',
1126-                                                                       'menu' => $_nav_menu->term_id,
1127-                                                               ),
1128-                                                               admin_url( 'nav-menus.php' )
1129-                                                       ));
1130-                                               ?>" class="nav-tab hide-if-no-js">
1131-                                                       <?php echo esc_html( $_nav_menu->truncated_name ); ?>
1132-                                               </a><?php endif;
1133-                               endforeach;
1134-                               if ( 0 == $nav_menu_selected_id ) : ?><span class="nav-tab menu-add-new nav-tab-active">
1135-                                       <?php printf( '<abbr title="%s">+</abbr>', esc_html__( 'Add menu' ) ); ?>
1136-                               </span><?php else : ?><a href="<?php
1137-                                       echo esc_url(add_query_arg(
1138-                                               array(
1139-                                                       'action' => 'edit',
1140-                                                       'menu' => 0,
1141-                                               ),
1142-                                               admin_url( 'nav-menus.php' )
1143-                                       ));
1144-                               ?>" class="nav-tab menu-add-new">
1145-                                       <?php printf( '<abbr title="%s">+</abbr>', esc_html__( 'Add menu' ) ); ?>
1146-                               </a><?php endif; ?>
1147-                       </div>
1148-                       </div>
1149-                       <div class="menu-edit">
1150-                               <form id="update-nav-menu" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data">
1151-                                       <div id="nav-menu-header">
1152-                                               <div id="submitpost" class="submitbox">
1153-                                                       <div class="major-publishing-actions">
1154-                                                               <label class="menu-name-label howto open-label" for="menu-name">
1155-                                                                       <span><?php _e('Menu Name'); ?></span>
1156-                                                                       <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 ); ?>" />
1157-                                                               </label>
1158-                                                               <?php if ( !empty( $nav_menu_selected_id ) ) :
1159-                                                                       if ( ! isset( $auto_add ) ) {
1160-                                                                               $auto_add = get_option( 'nav_menu_options' );
1161-                                                                               if ( ! isset( $auto_add['auto_add'] ) )
1162-                                                                                       $auto_add = false;
1163-                                                                               elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
1164-                                                                                       $auto_add = true;
1165-                                                                               else
1166-                                                                                       $auto_add = false;
1167-                                                                       }
1168-                                                               ?>
1169-                                                               <div class="auto-add-pages">
1170-                                                                       <label class="howto"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" value="1" /> <?php printf( __('Automatically add new top-level pages' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label>
1171-                                                               </div>
1172-                                                               <?php endif; ?>
1173-                                                               <br class="clear" />
1174-                                                               <div class="publishing-action">
1175-                                                                       <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
1176-                                                               </div><!-- END .publishing-action -->
1177+                       <form id="update-nav-menu" action="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>" method="post" enctype="multipart/form-data">
1178+                               <div class="menu-edit <?php if ( $add_new_screen ) echo 'blank-slate'; ?>">
1179+                                       <?php
1180+                                       wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
1181+                                       wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
1182+                                       wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' );
1183 
1184-                                                               <?php if ( ! empty( $nav_menu_selected_id ) ) : ?>
1185-                                                               <div class="delete-action">
1186-                                                                       <a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( admin_url('nav-menus.php?action=delete&amp;menu=' . $nav_menu_selected_id), 'delete-nav_menu-' . $nav_menu_selected_id ) ); ?>"><?php _e('Delete Menu'); ?></a>
1187-                                                               </div><!-- END .delete-action -->
1188-                                                               <?php endif; ?>
1189-                                                       </div><!-- END .major-publishing-actions -->
1190-                                               </div><!-- END #submitpost .submitbox -->
1191-                                               <?php
1192-                                               wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
1193-                                               wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
1194-                                               wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' );
1195-                                               ?>
1196-                                               <input type="hidden" name="action" value="update" />
1197-                                               <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
1198-                                       </div><!-- END #nav-menu-header -->
1199+                                       if ( $one_theme_location_no_menus ) { ?>
1200+                                               <input type="hidden" name="zero-menu-state" value="true" />
1201+                                       <?php } ?>
1202+                                       <input type="hidden" name="action" value="update" />
1203+                                       <input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
1204+                                       <div id="nav-menu-header">
1205+                                               <div class="major-publishing-actions">
1206+                                                       <label class="menu-name-label howto open-label" for="menu-name">
1207+                                                               <span><?php _e( 'Menu Name' ); ?></span>
1208+                                                               <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 if ( $one_theme_location_no_menus ) _e( 'Menu 1' ); else echo esc_attr( $nav_menu_selected_title ); ?>" />
1209+                                                       </label>
1210+                                                       <div class="publishing-action">
1211+                                                               <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
1212+                                                       </div><!-- END .publishing-action -->
1213+                                               </div><!-- END .major-publishing-actions -->
1214+                                       </div><!-- END .nav-menu-header -->
1215                                        <div id="post-body">
1216                                                <div id="post-body-content">
1217+                                                       <?php if ( ! $add_new_screen ) : ?>
1218+                                                       <?php $starter_copy = ( $one_theme_location_no_menus ) ? __( 'Edit your default menu by adding or removing items. Drag each item into the order you prefer. Click Create Menu to save your changes.' ) : __( 'Drag each item into the order you prefer. Click an item to reveal additional configuration options.' ); ?>
1219+                                                       <div class="drag-instructions post-body-plain" <?php if ( isset( $menu_items ) && 0 == count( $menu_items ) ) { ?>style="display: none;"<?php } ?>>
1220+                                                               <p><?php echo $starter_copy; ?></p>
1221+                                                       </div>
1222                                                        <?php
1223-                                                       if ( isset( $edit_markup ) ) {
1224-                                                               if ( ! is_wp_error( $edit_markup ) )
1225-                                                                       echo $edit_markup;
1226-                                                       } else if ( empty( $nav_menu_selected_id ) ) {
1227-                                                               echo '<div class="post-body-plain">';
1228-                                                               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>';
1229-                                                               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>';
1230-                                                               echo '<p>' . __('When you have finished building your custom menu, make sure you click the Save Menu button.') . '</p>';
1231-                                                               echo '</div>';
1232-                                                       }
1233+                                                       if ( isset( $edit_markup ) && ! is_wp_error( $edit_markup ) ) {
1234+                                                               echo $edit_markup;
1235+                                                       } else {
1236                                                        ?>
1237+                                                       <ul class="menu" id="menu-to-edit"></ul>
1238+                                                       <?php } ?>
1239+                                                       <?php endif; ?>
1240+                                                       <?php if ( $add_new_screen ) : ?>
1241+                                                               <p class="post-body-plain"><?php _e( 'Give your menu a name above, then click Create Menu.' ); ?></p>
1242+                                                       <?php endif; ?>
1243+                                                       <div class="menu-settings" <?php if ( $one_theme_location_no_menus ) { ?>style="display: none;"<?php } ?>>
1244+                                                               <?php
1245+                                                               if ( ! isset( $auto_add ) ) {
1246+                                                                       $auto_add = get_option( 'nav_menu_options' );
1247+                                                                       if ( ! isset( $auto_add['auto_add'] ) )
1248+                                                                               $auto_add = false;
1249+                                                                       elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
1250+                                                                               $auto_add = true;
1251+                                                                       else
1252+                                                                               $auto_add = false;
1253+                                                               } ?>
1254+
1255+                                                               <dl class="auto-add-pages">
1256+                                                                       <dt class="howto"><?php _e( 'Auto add pages' ); ?></dt>
1257+                                                                       <dd class="checkbox-input"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label></dd>
1258+                                                               </dl>
1259+
1260+                                                               <?php if ( current_theme_supports( 'menus' ) ) : ?>
1261+
1262+                                                                       <dl class="menu-theme-locations">
1263+                                                                               <dt class="howto"><?php _e( 'Theme locations' ); ?></dt>
1264+                                                                               <?php foreach ( $locations as $location => $description ) : ?>
1265+                                                                               <dd class="checkbox-input">
1266+                                                                                       <input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label>
1267+                                                                                       <?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?>
1268+                                                                                       <span class="theme-location-set"> <?php printf( __( "(Currently set to: %s)" ), wp_get_nav_menu_object( $menu_locations[ $location ] )->name ); ?> </span>
1269+                                                                                       <?php endif; ?>
1270+                                                                               </dd>
1271+                                                                               <?php endforeach; ?>
1272+                                                                       </dl>
1273+
1274+                                                               <?php endif; ?>
1275+
1276+                                                       </div>
1277                                                </div><!-- /#post-body-content -->
1278                                        </div><!-- /#post-body -->
1279                                        <div id="nav-menu-footer">
1280                                                <div class="major-publishing-actions">
1281-                                               <div class="publishing-action">
1282-                                                       <?php
1283-                                                       if ( ! empty( $nav_menu_selected_id ) )
1284-                                                               submit_button( __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) );
1285-                                                       ?>
1286-                                               </div>
1287-                                               </div>
1288+                                                       <?php if ( 0 != $menu_count && ! $add_new_screen ) : ?>
1289+                                                       <span class="delete-action">
1290+                                                               <a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'menu' => $nav_menu_selected_id, admin_url() ) ), 'delete-nav_menu-' . $nav_menu_selected_id) ); ?>"><?php _e('Delete Menu'); ?></a>
1291+                                                       </span><!-- END .delete-action -->
1292+                                                       <?php endif; ?>
1293+                                                       <div class="publishing-action">
1294+                                                               <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
1295+                                                       </div><!-- END .publishing-action -->
1296+                                               </div><!-- END .major-publishing-actions -->
1297                                        </div><!-- /#nav-menu-footer -->
1298-                               </form><!-- /#update-nav-menu -->
1299-                       </div><!-- /.menu-edit -->
1300+                               </div><!-- /.menu-edit -->
1301+                       </form><!-- /#update-nav-menu -->
1302                </div><!-- /#menu-management -->
1303        </div><!-- /#menu-management-liquid -->
1304        </div><!-- /#nav-menus-frame -->
1305 </div><!-- /.wrap-->
1306-
1307+<script type="text/javascript">var oneThemeLocationNoMenus = <?php if ( $one_theme_location_no_menus ) echo 'true'; else echo 'false'; ?>;</script>
1308 <?php include( './admin-footer.php' ); ?>
1309Index: wp-admin/css/colors-fresh.css
1310===================================================================
1311--- wp-admin/css/colors-fresh.css       (revision 23402)
1312+++ wp-admin/css/colors-fresh.css       (working copy)
1313@@ -409,7 +409,8 @@
1314 
1315 .submitbox .submitdelete:hover,
1316 #media-items a.delete:hover,
1317-#media-items a.delete-permanently:hover {
1318+#media-items a.delete-permanently:hover,
1319+#nav-menu-footer .menu-delete:hover {
1320        color: #fff;
1321        background-color: #f00;
1322        border-bottom-color: #f00;
1323@@ -1741,6 +1742,27 @@
1324        background: #21759b;
1325        color: #fff;
1326 }
1327+
1328+.manage-menus {
1329+       border: 1px solid #eeeeee;
1330+       background: #fbfbfb;
1331+}
1332+
1333+.menu-settings {
1334+       border-top: 1px solid #eeeeee;
1335+}
1336+
1337+.theme-location-set {
1338+       color: #999999;
1339+}
1340+
1341+.nav-menus-php .delete-action a {
1342+       color: #bc0b0b;
1343+}
1344+
1345+.is-submenu {
1346+       color: #999999;
1347+}
1348 /* end added from nav-menu.css */
1349 
1350 .nav-tab {
1351Index: wp-admin/css/wp-admin-rtl.css
1352===================================================================
1353--- wp-admin/css/wp-admin-rtl.css       (revision 23402)
1354+++ wp-admin/css/wp-admin-rtl.css       (working copy)
1355@@ -44,6 +44,8 @@
1356 25.0 - TinyMCE tweaks
1357 26.0 - Full Overlay w/ Sidebar
1358 27.0 - Customize Loader
1359+28.0 - Nav Menus
1360+29.0 - HiDPI
1361 
1362 
1363 ------------------------------------------------------------------------------*/
1364@@ -2303,10 +2305,6 @@
1365        margin-right:0;
1366 }
1367 
1368-.auto-add-pages {
1369-       float: right;
1370-}
1371-
1372 /* Star ratings */
1373 div.star-holder {
1374        background: url('../images/stars-rtl.png?ver=20121108') repeat-x bottom right;
1375@@ -2534,9 +2532,38 @@
1376        direction: ltr;
1377 }
1378 
1379-/**
1380- * HiDPI Displays
1381- */
1382+/*------------------------------------------------------------------------------
1383+  28.0 - Nav Menus
1384+------------------------------------------------------------------------------*/
1385+.nav-menus-php .major-publishing-actions .publishing-action {
1386+       float: left;
1387+}
1388+
1389+.menu-settings dd {
1390+       float: right;
1391+       padding-right: 170px;
1392+}
1393+
1394+.manage-menus span {
1395+       float: right;
1396+}
1397+
1398+.menu-settings dt {
1399+       left: auto;
1400+       right: 0;
1401+}
1402+
1403+.menu-settings dd input,
1404+.menu-settings dd span,
1405+.menu-settings dd label,
1406+.manage-menus select {
1407+       float: right;
1408+       margin-right: 6px;
1409+}
1410+
1411+/*------------------------------------------------------------------------------
1412+  29.0 - HiDPI
1413+------------------------------------------------------------------------------*/
1414 @media print,
1415   (-o-min-device-pixel-ratio: 5/4),
1416   (-webkit-min-device-pixel-ratio: 1.25),
1417Index: wp-admin/css/wp-admin.css
1418===================================================================
1419--- wp-admin/css/wp-admin.css   (revision 23402)
1420+++ wp-admin/css/wp-admin.css   (working copy)
1421@@ -6760,8 +6760,17 @@
1422 
1423 /* nav-menu */
1424 
1425+.nav-menus-php #message {
1426+       display: none;
1427+}
1428+
1429+.no-js #message {
1430+       display: block;
1431+}
1432+
1433 #nav-menus-frame {
1434        margin-left: 300px;
1435+       margin-top: 28px;
1436 }
1437 
1438 #wpbody-content #menu-settings-column {
1439@@ -6770,13 +6779,9 @@
1440        margin-left: -300px;
1441        clear: both;
1442        float: left;
1443-       padding-top: 24px;
1444+       padding-top: 0;
1445 }
1446 
1447-.no-js #wpbody-content #menu-settings-column {
1448-       padding-top: 31px;
1449-}
1450-
1451 #menu-settings-column .inside {
1452        clear: both;
1453        margin: 10px 0 0;
1454@@ -6795,10 +6800,89 @@
1455        position: relative;
1456 }
1457 
1458+.blank-slate .menu-name {
1459+       height: 2em;
1460+}
1461+
1462+.blank-slate .menu-settings {
1463+       border: none;
1464+       margin-top: 0;
1465+       padding-top: 0;
1466+       overflow: hidden;
1467+}
1468+
1469+.is-submenu {
1470+       font-style: italic;
1471+       font-weight: normal;
1472+       margin-left: 4px;
1473+}
1474+
1475+.manage-menus {
1476+       margin-top: 13px;
1477+       padding: 10px;
1478+       overflow: hidden;
1479+       -webkit-border-radius: 3px;
1480+       border-radius: 3px;
1481+}
1482+
1483+.manage-menus select {
1484+       float: left;
1485+       margin-right: 6px;
1486+}
1487+
1488+.manage-menus .selected-menu {
1489+       float: left;
1490+       margin: 5px 6px 0 0;
1491+}
1492+
1493+.manage-menus .submit-btn {
1494+       float: left;
1495+       margin-top: 1px;
1496+}
1497+
1498+.menu-edit p {
1499+       margin: .3em 0 .6em;
1500+}
1501+
1502+.menu-settings {
1503+       margin-top: 2em;
1504+       padding-top: 16px;
1505+       overflow: hidden;
1506+}
1507+
1508+.menu-settings dl {
1509+       margin: 0 0 10px;
1510+       overflow: hidden;
1511+       position: relative;
1512+}
1513+
1514+.menu-settings dd {
1515+       float: left;
1516+       margin: 0;
1517+       width: 60%;
1518+       padding-left: 170px;
1519+}
1520+
1521+.menu-settings dt {
1522+       clear: both;
1523+       left: 0;
1524+       padding: 3px 0 0;
1525+       position: absolute;
1526+}
1527+
1528+.menu-edit .checkbox-input {
1529+       margin-top: 4px;
1530+}
1531+
1532+.theme-location-set {
1533+       font-size: 11px;
1534+}
1535+
1536 /* Menu Container */
1537 #menu-management-liquid {
1538        float: left;
1539        min-width: 100%;
1540+       margin-top: 3px;
1541 }
1542 
1543 #menu-management {
1544@@ -6813,7 +6897,7 @@
1545 }
1546 
1547 .nav-menus-php #post-body {
1548-       padding: 10px;
1549+       padding: 0 10px;
1550        border-width: 1px 0;
1551        border-style: solid;
1552 }
1553@@ -6825,8 +6909,13 @@
1554 
1555 #nav-menu-header {
1556        border-bottom: 1px solid;
1557+       margin-bottom: 13px;
1558 }
1559 
1560+#nav-menu-header .menu-name-label {
1561+       margin-top: 2px;
1562+}
1563+
1564 #nav-menu-footer {
1565        border-top: 1px solid;
1566 }
1567@@ -6845,55 +6934,6 @@
1568        font-weight:bold;
1569 }
1570 
1571-/* Menu Tabs */
1572-
1573-#menu-management .nav-tabs-nav {
1574-       margin: 0 20px;
1575-}
1576-
1577-#menu-management .nav-tabs-arrow {
1578-       width: 10px;
1579-       padding: 0 5px 4px;
1580-       cursor: pointer;
1581-       position: absolute;
1582-       top: 0;
1583-       line-height: 22px;
1584-       font-size: 18px;
1585-       text-shadow: 0 1px 0 #fff;
1586-}
1587-
1588-#menu-management .nav-tabs-arrow-left {
1589-       left: 0;
1590-}
1591-
1592-#menu-management .nav-tabs-arrow-right {
1593-       right: 0;
1594-       text-align: right;
1595-}
1596-
1597-#menu-management .nav-tabs-wrapper {
1598-       width: 100%;
1599-       height: 28px;
1600-       margin-bottom: -1px;
1601-       overflow: hidden;
1602-}
1603-
1604-#menu-management .nav-tabs {
1605-       padding-left: 20px;
1606-       padding-right: 10px;
1607-}
1608-
1609-.js #menu-management .nav-tabs {
1610-       float: left;
1611-       margin-left: 0px;
1612-       margin-right: -400px;
1613-}
1614-
1615-#menu-management .nav-tab {
1616-       margin-bottom: 0;
1617-       font-size: 14px;
1618-}
1619-
1620 #select-nav-menu-container {
1621        text-align: right;
1622        padding: 0 10px 3px 10px;
1623@@ -7090,7 +7130,8 @@
1624 }
1625 
1626 #menu-to-edit {
1627-       padding: 1em 0;
1628+       margin: 0;
1629+       padding: 0.1em 0;
1630 }
1631 
1632 .menu ul {
1633@@ -7106,7 +7147,7 @@
1634        clear:both;
1635        line-height:1.5em;
1636        position:relative;
1637-       margin: 13px 0 0 0;
1638+       margin: 9px 0 0;
1639 }
1640 
1641 .menu-item-handle {
1642@@ -7333,34 +7374,16 @@
1643        text-align: right;
1644        float: right;
1645        line-height: 23px;
1646-       margin: 5px 0 1px;
1647+       margin: 2px 0 1px;
1648 }
1649 
1650-.nav-menus-php .major-publishing-actions .delete-action {
1651-       vertical-align: middle;
1652-       text-align: left;
1653-       float: left;
1654-       padding-right: 15px;
1655-       margin-top: 5px;
1656+.nav-menus-php .blank-slate .menu-settings {
1657+       display: none;
1658 }
1659 
1660-.menu-name-label span,
1661-.auto-add-pages label {
1662-       font-size: 12px;
1663-       font-style: normal;
1664-}
1665-
1666-.menu-name-label {
1667-       margin-right: 15px;
1668-}
1669-
1670-.auto-add-pages input {
1671-       margin-top: 0;
1672-}
1673-
1674-.auto-add-pages {
1675-       margin-top: 4px;
1676+.nav-menus-php .delete-action {
1677        float: left;
1678+       margin-top: 2px;
1679 }
1680 
1681 .nav-menus-php .submitbox .submitcancel {