Widgets: highlight all drop zones (open and closed sidebars) on starting to drag a widget to indicate "droppability", fixes #26168.

git-svn-id: https://develop.svn.wordpress.org/trunk@26474 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2013-11-29 17:57:05 +00:00
parent 81557ba37c
commit 28da4145a6
2 changed files with 11 additions and 25 deletions

View File

@ -10082,7 +10082,6 @@ input.newtag:focus ~ div.taghint {
.widget.ui-sortable-helper {
opacity: 0.8;
z-index: 2000;
}
.widget-placeholder {
@ -10293,11 +10292,10 @@ div#widgets-right .closed .widgets-sortables {
}
/* Dragging a widget over a closed sidebar */
#widgets-right .widgets-holder-wrap.closed.widget-hover {
#widgets-right .widgets-holder-wrap.widget-hover {
border-color: #777;
box-shadow: 0 1px 2px rgba(0,0,0,0.3);
opacity: 0.6;
}
}
/* Accessibility Mode */
.widgets_access #widgets-left .widget .widget-top {

View File

@ -117,7 +117,7 @@ wpWidgets = {
distance: 2,
containment: 'document',
start: function( event, ui ) {
var $this = $(this),
var height, $this = $(this),
$wrap = $this.parent(),
inside = ui.item.children('.widget-inside');
@ -126,15 +126,11 @@ wpWidgets = {
$(this).sortable('refreshPositions');
}
if ( $wrap.hasClass('closed') ) {
// There is a bug in UI Sortable that prevents firing of "over" when dragging a connected Draggable.
// This won't be needed when the bug is fixed.
$wrap.addClass('widget-hover');
} else {
if ( ! $wrap.hasClass('closed') ) {
// Lock all open sidebars min-height when starting to drag.
// Prevents jumping when dragging a widget from an open sidebar to a closed sidebar below.
$wrap.css( 'min-height', $wrap.height() + 'px' );
$this.css( 'min-height', $this.height() - 2 + 'px' );
height = ui.item.hasClass('ui-draggable') ? $this.height() : 1 + $this.height();
$this.css( 'min-height', height + 'px' );
}
},
@ -152,7 +148,7 @@ wpWidgets = {
addNew = $widget.find('input.add_new').val();
widgetNumber = $widget.find('input.multi_number').val();
$widget.attr( 'style', '' );
$widget.attr( 'style', '' ).removeClass('ui-draggable');
the_id = '';
if ( addNew ) {
@ -179,7 +175,7 @@ wpWidgets = {
$sidebar = $widget.parent();
if ( $sidebar.parent().hasClass('closed') ) {
$sidebar.parent().removeClass('widget-hover closed jump-open');
$sidebar.parent().removeClass('closed');
$children = $sidebar.children('.widget');
// Make sure the dropped widget is at the top
@ -200,21 +196,13 @@ wpWidgets = {
}
},
over: function() {
var $wrap = $(this).parent();
if ( $wrap.hasClass('closed') ) {
$wrap.addClass('widget-hover');
}
},
out: function() {
$(this).parent().removeClass('widget-hover');
activate: function() {
$(this).parent().addClass( 'widget-hover' );
},
deactivate: function() {
// Remove all min-height added on "start"
$(this).css( 'min-height', '' ).parent().css( 'min-height', '' );
$(this).css( 'min-height', '' ).parent().removeClass( 'widget-hover' );
},
receive: function( event, ui ) {