Only save menu item positions on save. Had implications for draft items otherwise. see #13337, props koopersmith.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4cf46b6d96
commit
3f796315da
|
@ -227,8 +227,6 @@ var wpNavMenu;
|
|||
}
|
||||
// Update the item data.
|
||||
ui.item.updateParentMenuItemDBId();
|
||||
// Update positions
|
||||
api.recalculateMenuItemPositions();
|
||||
},
|
||||
change: function(e, ui) {
|
||||
// Make sure the placeholder is inside the menu.
|
||||
|
@ -291,6 +289,8 @@ var wpNavMenu;
|
|||
if ( e.target && e.target.className ) {
|
||||
if ( -1 != e.target.className.indexOf('item-edit') ) {
|
||||
return that.eventOnClickEditLink(e.target);
|
||||
} else if ( -1 != e.target.className.indexOf('menu-save') ) {
|
||||
return that.eventOnClickMenuSave(e.target);
|
||||
} else if ( -1 != e.target.className.indexOf('menu-delete') ) {
|
||||
return that.eventOnClickMenuDelete(e.target);
|
||||
} else if ( -1 != e.target.className.indexOf('item-delete') ) {
|
||||
|
@ -456,7 +456,7 @@ var wpNavMenu;
|
|||
|
||||
attachHomeLinkListener : function() {
|
||||
$('.add-home-link', '.customlinkdiv').click(function(e) {
|
||||
api.addLinkToMenu( navMenuL10n.homeurl, navMenuL10n.home, api.addMenuItemToTop, api.recalculateMenuItemPositions );
|
||||
api.addLinkToMenu( navMenuL10n.homeurl, navMenuL10n.home, api.addMenuItemToTop );
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
@ -669,6 +669,12 @@ var wpNavMenu;
|
|||
return false;
|
||||
},
|
||||
|
||||
eventOnClickMenuSave : function(clickedEl) {
|
||||
// Update menu item position data
|
||||
api.menuList.find('.menu-item-data-position').val( function(index) { return index + 1; } );
|
||||
return true;
|
||||
},
|
||||
|
||||
eventOnClickMenuDelete : function(clickedEl) {
|
||||
// Delete warning AYS
|
||||
if ( confirm( navMenuL10n.warnDeleteMenu ) )
|
||||
|
@ -775,7 +781,6 @@ var wpNavMenu;
|
|||
el.addClass('deleting').fadeOut( 350 , function() {
|
||||
el.remove();
|
||||
children.shiftDepthClass(-1).updateParentMenuItemDBId();
|
||||
api.recalculateMenuItemPositions();
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -838,10 +843,6 @@ var wpNavMenu;
|
|||
return itemData;
|
||||
},
|
||||
|
||||
recalculateMenuItemPositions : function() {
|
||||
api.menuList.find('.menu-item-data-position').val( function(index) { return index + 1; } );
|
||||
},
|
||||
|
||||
depthToPx : function(depth) {
|
||||
return depth * api.options.menuItemDepthPerLevel;
|
||||
},
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -484,7 +484,7 @@ require_once( 'admin-header.php' );
|
|||
</label>
|
||||
|
||||
<div class="publishing-action">
|
||||
<input class="button-primary" name="save_menu" type="submit" value="<?php empty($nav_menu_selected_id) ? esc_attr_e('Create Menu') : esc_attr_e('Save Menu'); ?>" />
|
||||
<input class="button-primary menu-save" name="save_menu" type="submit" value="<?php empty($nav_menu_selected_id) ? esc_attr_e('Create Menu') : esc_attr_e('Save Menu'); ?>" />
|
||||
</div><!--END .publishing-action-->
|
||||
|
||||
<?php if ( ! empty( $nav_menu_selected_id ) ) : ?>
|
||||
|
|
|
@ -393,7 +393,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
) );
|
||||
|
||||
// Custom Navigation
|
||||
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100510' );
|
||||
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100513' );
|
||||
$scripts->localize( 'nav-menu', 'navMenuL10n', array(
|
||||
'home' => _x('Home', 'nav menu home label'),
|
||||
'homeurl' => home_url('/'),
|
||||
|
|
Loading…
Reference in New Issue