Don't hide early nav menu instructions until the menu is no longer empty. props koopersmith, see #13525

git-svn-id: http://svn.automattic.com/wordpress/trunk@14917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin
2010-05-26 00:41:18 +00:00
parent 810bbe0cc0
commit b0e128e69b
6 changed files with 22 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@@ -409,6 +409,9 @@ body.js .item-order {
}
/* Menu editing */
.menu-instructions-inactive {
display: none;
}
.menu-item-settings {
background: #F9F9F9;
display:block;

View File

@@ -962,6 +962,13 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
// If the menu exists, get its items.
if ( is_nav_menu( $menu ) ) {
$menu_items = wp_get_nav_menu_items( $menu->term_id, array('post_status' => 'any') );
$result = '<div id="menu-instructions" class="post-body-plain';
$result .= ( ! empty($menu_items) ) ? ' menu-instructions-inactive">' : '">';
$result .= __('Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu.');
$result .= '</div>';
if( empty($menu_items) )
return $result;
$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
@@ -970,7 +977,8 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
else
return new WP_Error( 'menu_walker_not_exist', sprintf( __('The Walker class named <strong>%s</strong> does not exist.'), $walker_class_name ) );
return walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) );
$result .= walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) );
return $result;
} elseif ( is_wp_error( $menu ) ) {
return $menu;
}

View File

@@ -535,7 +535,10 @@ var wpNavMenu;
};
$.post( ajaxurl, params, function(menuMarkup) {
var ins = $('#menu-instructions');
processMethod(menuMarkup, params);
if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length )
ins.addClass('menu-instructions-inactive');
callback();
});
},
@@ -826,8 +829,11 @@ var wpNavMenu;
opacity : 0,
height: 0
}, 350, function() {
var ins = $('#menu-instructions');
el.remove();
children.shiftDepthClass(-1).updateParentMenuItemDBId();
if( ! ins.siblings().length )
ins.removeClass('menu-instructions-inactive');
});
},

File diff suppressed because one or more lines are too long