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

View File

@ -385,7 +385,7 @@ function wp_default_scripts( &$scripts ) {
) );
// Custom Navigation
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100524a' );
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100525' );
$scripts->localize( 'nav-menu', 'navMenuL10n', array(
'home' => _x('Home', 'nav menu home label'),
'homeurl' => home_url('/'),
@ -467,7 +467,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100525' );
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100525a' );
foreach ( $rtl_styles as $rtl_style ) {
$styles->add_data( $rtl_style, 'rtl', true );