Revert [14434] et al. Going back to checkboxes in the nav menus, holding drag-drop for future release. see #13247.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
02d7ec59cc
commit
e34150ab5b
File diff suppressed because one or more lines are too long
|
@ -205,62 +205,6 @@ body {
|
|||
height: 400px;
|
||||
}
|
||||
|
||||
#side-sortables .potential-menu-item {
|
||||
margin-left: 0;
|
||||
position: relative;
|
||||
margin: 6px 0;
|
||||
}
|
||||
#side-sortables .potential-menu-item ul {
|
||||
margin-left: 0;
|
||||
|
||||
}
|
||||
#side-sortables .potential-menu-item li {
|
||||
cursor: move;
|
||||
padding: 1px 6px;
|
||||
border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
-khtml-border-radius: 4px;
|
||||
}
|
||||
.potential-menu-item li {
|
||||
background: #eee;
|
||||
border: 1px solid #dfdfdf;
|
||||
color: #646464;
|
||||
}
|
||||
.potential-menu-item li:hover {
|
||||
color: #222;
|
||||
border-color: #ccc;
|
||||
background: #f9f9f9;
|
||||
}
|
||||
.selected-menu-item li {
|
||||
background: #FFFFE0;
|
||||
border-color: #E6DB55;
|
||||
}
|
||||
.selected-menu-item li:hover {
|
||||
background: #ffffbe;
|
||||
border-color: #e2d537;
|
||||
}
|
||||
.potential-menu-item .item-controls,
|
||||
.potential-menu-item .menu-item-transport {
|
||||
display: none;
|
||||
}
|
||||
.potential-menu-item .ui-draggable-dragging div,
|
||||
.potential-menu-item .menu-item-handle .item-controls {
|
||||
display: block;
|
||||
}
|
||||
#side-sortables .new-menu-item,
|
||||
#side-sortables .new-menu-item li,
|
||||
#side-sortables .additional-menu-items li {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
}
|
||||
#side-sortables .additional-menu-items li {
|
||||
margin-top: 13px;
|
||||
}
|
||||
.item-edit img.waiting {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Button Primary Actions */
|
||||
#menu-container .submit { margin: 0px 0px 10px; padding: 0px; }
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2008,7 +2008,7 @@ input#link_url {
|
|||
.nav-menus-php .posttypediv div.tabs-panel,
|
||||
.nav-menus-php .taxonomydiv div.tabs-panel {
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
max-height: 205px;
|
||||
}
|
||||
|
||||
div.tabs-panel-active {
|
||||
|
|
|
@ -665,7 +665,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
|
|||
return;
|
||||
}
|
||||
// paginate browsing for large numbers of objects
|
||||
$per_page = 13;
|
||||
$per_page = 50;
|
||||
$pagenum = isset( $_REQUEST[$taxonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
|
||||
$offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
|
||||
|
||||
|
|
|
@ -114,8 +114,6 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
|
||||
this.initTabManager();
|
||||
|
||||
this.initAddMenuItemDraggables();
|
||||
|
||||
this.checkForEmptyMenu();
|
||||
},
|
||||
|
||||
|
@ -177,27 +175,6 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
});
|
||||
});
|
||||
},
|
||||
selectItem : function() {
|
||||
return this.each(function(){
|
||||
$(this).addClass('selected-menu-item')
|
||||
.next().children('input').attr('checked','checked');
|
||||
});
|
||||
},
|
||||
deselectItem : function() {
|
||||
return this.each(function(){
|
||||
$(this).removeClass('selected-menu-item')
|
||||
.next().children('input').removeAttr('checked');
|
||||
});
|
||||
},
|
||||
toggleItem : function() {
|
||||
return this.each(function(){
|
||||
var t = $(this);
|
||||
if( t.hasClass('selected-menu-item') )
|
||||
t.deselectItem();
|
||||
else
|
||||
t.selectItem();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Adds selected menu items to the menu.
|
||||
*
|
||||
|
@ -227,7 +204,7 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
// Add the items
|
||||
api.addItemToMenu(menuItems, processMethod, function(){
|
||||
// Deselect the items and hide the ajax spinner
|
||||
checkboxes.parent().prev().deselectItem();
|
||||
checkboxes.removeAttr('checked');
|
||||
t.find('img.waiting').hide();
|
||||
});
|
||||
});
|
||||
|
@ -263,20 +240,16 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
var height, width, parent, children, maxChildDepth;
|
||||
|
||||
transport = ui.item.children('.menu-item-transport');
|
||||
// Check if the item is in the menu, or new
|
||||
newItem = ( ui.helper.hasClass('new-menu-item') );
|
||||
|
||||
// Set depths. currentDepth must be set before children are located.
|
||||
originalDepth = ( newItem ) ? 0 : ui.item.menuItemDepth();
|
||||
updateCurrentDepth(ui, originalDepth);
|
||||
|
||||
if( ! newItem ) {
|
||||
// Attach child elements to parent
|
||||
// Skip the placeholder
|
||||
parent = ( ui.item.next()[0] == ui.placeholder[0] ) ? ui.item.next() : ui.item;
|
||||
children = parent.childMenuItems();
|
||||
transport.append( children );
|
||||
}
|
||||
// Attach child elements to parent
|
||||
// Skip the placeholder
|
||||
parent = ( ui.item.next()[0] == ui.placeholder[0] ) ? ui.item.next() : ui.item;
|
||||
children = parent.childMenuItems();
|
||||
transport.append( children );
|
||||
|
||||
// Now that the element is complete, we can update...
|
||||
updateDepthRange(ui);
|
||||
|
@ -291,12 +264,10 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
|
||||
// Update the width of the placeholder to match the moving item.
|
||||
maxChildDepth = originalDepth;
|
||||
if( ! newItem ) { // Children have already been attached to new items
|
||||
children.each(function(){
|
||||
var depth = $(this).menuItemDepth();
|
||||
maxChildDepth = (depth > maxChildDepth) ? depth : maxChildDepth;
|
||||
});
|
||||
}
|
||||
children.each(function(){
|
||||
var depth = $(this).menuItemDepth();
|
||||
maxChildDepth = (depth > maxChildDepth) ? depth : maxChildDepth;
|
||||
});
|
||||
width = ui.helper.find('.menu-item-handle').outerWidth(); // Get original width
|
||||
width += depthToPx(maxChildDepth - originalDepth); // Account for children
|
||||
width -= 2; // Subtract 2 for borders
|
||||
|
@ -308,23 +279,13 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
// Return child elements to the list
|
||||
children = transport.children().insertAfter(ui.item);
|
||||
|
||||
if( newItem ) {
|
||||
// Remove the helper item
|
||||
ui.item.remove();
|
||||
// Update depth classes
|
||||
if( depthChange != 0 )
|
||||
children.shiftDepthClass( depthChange );
|
||||
// All new menu items must be updated
|
||||
children.updateParentMenuItemDBId();
|
||||
} else {
|
||||
// Update depth classes
|
||||
if( depthChange != 0 ) {
|
||||
ui.item.updateDepthClass( currentDepth );
|
||||
children.shiftDepthClass( depthChange );
|
||||
}
|
||||
// Update the item data.
|
||||
ui.item.updateParentMenuItemDBId();
|
||||
// Update depth classes
|
||||
if( depthChange != 0 ) {
|
||||
ui.item.updateDepthClass( currentDepth );
|
||||
children.shiftDepthClass( depthChange );
|
||||
}
|
||||
// Update the item data.
|
||||
ui.item.updateParentMenuItemDBId();
|
||||
// Update positions
|
||||
recalculateMenuItemPositions();
|
||||
},
|
||||
|
@ -345,9 +306,6 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
if( depth != currentDepth )
|
||||
updateCurrentDepth(ui, depth);
|
||||
},
|
||||
receive: function(e, ui) {
|
||||
transport = ui.sender.children('.menu-item-transport');
|
||||
}
|
||||
});
|
||||
|
||||
function updateDepthRange(ui) {
|
||||
|
@ -371,54 +329,6 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
currentDepth = depth;
|
||||
}
|
||||
},
|
||||
|
||||
initAddMenuItemDraggables : function() {
|
||||
var menuItems = $('.potential-menu-item');
|
||||
menuItems.click(function(e){
|
||||
$(this).toggleItem();
|
||||
}).children().draggable({
|
||||
helper: 'clone',
|
||||
connectToSortable: 'ul#menu-to-edit',
|
||||
distance: 5,
|
||||
zIndex: 100,
|
||||
start: function(e, ui) {
|
||||
var target = $(e.target),
|
||||
item = target.parent(),
|
||||
li = item.parent(),
|
||||
items;
|
||||
|
||||
// Make sure the item we're dragging is selected.
|
||||
item.selectItem();
|
||||
// Set us to be the ajax target
|
||||
targetList = target.children('.menu-item-transport');
|
||||
// Get all checked elements and assemble selected items.
|
||||
items = li.parents('.tabs-panel').find('.selected-menu-item').children().not( ui.helper ).clone();
|
||||
ui.helper.children('.additional-menu-items').append( items );
|
||||
// This class tells the sortables to treat it as a new item.
|
||||
ui.helper.addClass('new-menu-item');
|
||||
|
||||
// CSS tweaks to remove some unnecessary items
|
||||
ui.helper.children('div').hide();
|
||||
items.first().css('margin-top', 0);
|
||||
|
||||
// Make the items look like menu items
|
||||
items.children('div').addClass('menu-item-handle');
|
||||
ui.helper.children('div').addClass('hidden-handle');
|
||||
|
||||
// Trigger the ajax
|
||||
li.parents('.inside').find('.add-to-menu input').click();
|
||||
|
||||
// Lock dimensions
|
||||
ui.helper.width( ui.helper.width() );
|
||||
ui.helper.height( ui.helper.height() );
|
||||
},
|
||||
stop: function(e, ui) {
|
||||
// Reset the targetList and unselect the menu items
|
||||
targetList = menuList;
|
||||
$(e.target).parents('.tabs-panel').find('.selected-menu-item').deselectItem();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
attachMenuEditListeners : function() {
|
||||
var that = this;
|
||||
|
@ -598,7 +508,7 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
|
||||
attachTabsPanelListeners : function() {
|
||||
$('#menu-settings-column').bind('click', function(e) {
|
||||
var selectAreaMatch, activePanel, panelIdMatch, wrapper, inputs, i;
|
||||
var selectAreaMatch, activePanel, panelIdMatch, wrapper, inputs, i, items;
|
||||
|
||||
if ( e.target && e.target.className && -1 != e.target.className.indexOf('nav-tab-link') ) {
|
||||
panelIdMatch = /#(.*)$/.exec(e.target.href);
|
||||
|
@ -630,13 +540,13 @@ var wpNavMenu, WPNavMenuHandler = function ($) {
|
|||
|
||||
return false;
|
||||
} else if ( e.target && e.target.className && -1 != e.target.className.indexOf('select-all') ) {
|
||||
selectAreaMatch = /#(.*)$/.exec(e.target.href), items;
|
||||
selectAreaMatch = /#(.*)$/.exec(e.target.href);
|
||||
if ( selectAreaMatch && selectAreaMatch[1] ) {
|
||||
items = $('#' + selectAreaMatch[1] + ' .tabs-panel-active .potential-menu-item');
|
||||
if( items.length === items.filter('.selected-menu-item').length )
|
||||
items.deselectItem();
|
||||
items = $('#' + selectAreaMatch[1] + ' .tabs-panel-active .menu-item-title input');
|
||||
if( items.length === items.filter(':checked').length )
|
||||
items.removeAttr('checked');
|
||||
else
|
||||
items.selectItem();
|
||||
items.attr('checked', 'checked');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -146,15 +146,7 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
|
|||
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
||||
|
||||
$output .= $indent . '<li>';
|
||||
$output .= '<ul class="potential-menu-item hide-if-no-js"><li><div>';
|
||||
$output .= '<span class="item-title">' . esc_html( $item->title ) . '</span>';
|
||||
$output .= '<span class="item-controls">';
|
||||
$output .= '<span class="item-type">' . esc_html( $item->append ) . '</span>';
|
||||
$output .= '<span class="item-edit">';
|
||||
$output .= '<img class="waiting" src="' . esc_url( admin_url( 'images/wpspin_light.gif' ) ) . '" />';
|
||||
$output .= '</span></span>';
|
||||
$output .= '</div><ul class="additional-menu-items"></ul><ul class="menu-item-transport"></ul></li></ul>';
|
||||
$output .= '<label class="menu-item-title hide-if-js">';
|
||||
$output .= '<label class="menu-item-title">';
|
||||
$output .= '<input type="checkbox" class="menu-item-checkbox" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
|
||||
$output .= esc_html( $item->title ) .'</label>';
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
) );
|
||||
|
||||
// Custom Navigation
|
||||
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100505' );
|
||||
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", false, '20100506' );
|
||||
$scripts->localize( 'nav-menu', 'navMenuL10n', array(
|
||||
'home' => _x('Home', 'nav menu home label'),
|
||||
'homeurl' => home_url('/'),
|
||||
|
@ -444,7 +444,7 @@ function wp_default_styles( &$styles ) {
|
|||
// Any rtl stylesheets that don't have a .dev version for ltr
|
||||
$no_suffix = array( 'farbtastic' );
|
||||
|
||||
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20100504' );
|
||||
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20100506' );
|
||||
|
||||
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20100219' );
|
||||
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
|
||||
|
@ -476,7 +476,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(), '20100504' );
|
||||
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100506' );
|
||||
|
||||
foreach ( $rtl_styles as $rtl_style ) {
|
||||
$styles->add_data( $rtl_style, 'rtl', true );
|
||||
|
|
Loading…
Reference in New Issue