- Fix support for expanding (wide) widgets in the Inactive Widgets area.
- Remove resizing of the sidebars height.
- Stop removing unneeded "for" attributes from labels inside the widgets. Was a fix for IE6 odd behaviour.  

See #26117.
Built from https://develop.svn.wordpress.org/trunk@26277


git-svn-id: http://core.svn.wordpress.org/trunk@26182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-11-20 01:35:10 +00:00
parent 0dcf40e749
commit 4070cdcf66
6 changed files with 42 additions and 51 deletions

View File

@ -10304,34 +10304,39 @@ div#widgets-right .closed .sidebar-description {
div#widgets-right .sidebar-name h3 { div#widgets-right .sidebar-name h3 {
padding: 15px 15px; padding: 15px 15px;
} }
div#widgets-right .sidebar-name .sidebar-name-arrow:before { div#widgets-right .sidebar-name .sidebar-name-arrow:before {
left: 0; left: 0;
top: 4px; top: 4px;
} }
div#widgets-right .widget-top { div#widgets-right .widget-top {
padding: 0; padding: 0;
background: #f7f7f7; background: #f7f7f7;
} }
div#widgets-right .widget-title-action { div#widgets-right .widget-title-action {
float: left; float: left;
position: relative; position: relative;
top: 14px; top: 14px;
left: 10px; left: 10px;
} }
div#widgets-right a.widget-action:after { div#widgets-right a.widget-action:after {
content: '\f111'; content: '\f111';
color: #888; color: #888;
} }
div#widgets-right .widget-inside { div#widgets-right .widget-inside {
border-top: 1px solid #dedede; border-top: 1px solid #dedede;
} }
div#widgets-right .widgets-sortables { div#widgets-right .widgets-sortables {
min-height: 42px !important; /* Inline styles */
padding: 0 8px; padding: 0 8px;
margin-bottom: 8px; margin-bottom: 8px;
position: relative; position: relative;
} }
div#widgets-right .widgets-sortables:before { div#widgets-right .widgets-sortables:before {
display: block; display: block;
content: ""; content: "";
@ -10348,6 +10353,11 @@ div#widgets-right .widgets-sortables:before {
color: #aaa; color: #aaa;
} }
.sidebar-name .spinner {
margin: -5px 5px;
float: none;
}
/* Accessibility Mode */ /* Accessibility Mode */
#available-widgets .widget-control-edit .edit { #available-widgets .widget-control-edit .edit {
display :none; display :none;

File diff suppressed because one or more lines are too long

View File

@ -10304,34 +10304,39 @@ div#widgets-right .closed .sidebar-description {
div#widgets-right .sidebar-name h3 { div#widgets-right .sidebar-name h3 {
padding: 15px 15px; padding: 15px 15px;
} }
div#widgets-right .sidebar-name .sidebar-name-arrow:before { div#widgets-right .sidebar-name .sidebar-name-arrow:before {
right: 0; right: 0;
top: 4px; top: 4px;
} }
div#widgets-right .widget-top { div#widgets-right .widget-top {
padding: 0; padding: 0;
background: #f7f7f7; background: #f7f7f7;
} }
div#widgets-right .widget-title-action { div#widgets-right .widget-title-action {
float: right; float: right;
position: relative; position: relative;
top: 14px; top: 14px;
right: 10px; right: 10px;
} }
div#widgets-right a.widget-action:after { div#widgets-right a.widget-action:after {
content: '\f111'; content: '\f111';
color: #888; color: #888;
} }
div#widgets-right .widget-inside { div#widgets-right .widget-inside {
border-top: 1px solid #dedede; border-top: 1px solid #dedede;
} }
div#widgets-right .widgets-sortables { div#widgets-right .widgets-sortables {
min-height: 42px !important; /* Inline styles */
padding: 0 8px; padding: 0 8px;
margin-bottom: 8px; margin-bottom: 8px;
position: relative; position: relative;
} }
div#widgets-right .widgets-sortables:before { div#widgets-right .widgets-sortables:before {
display: block; display: block;
content: ""; content: "";
@ -10348,6 +10353,11 @@ div#widgets-right .widgets-sortables:before {
color: #aaa; color: #aaa;
} }
.sidebar-name .spinner {
margin: -5px 5px;
float: none;
}
/* Accessibility Mode */ /* Accessibility Mode */
#available-widgets .widget-control-edit .edit { #available-widgets .widget-control-edit .edit {
display :none; display :none;

File diff suppressed because one or more lines are too long

View File

@ -10,8 +10,7 @@ wpWidgets = {
chooser = $('#widgets-chooser'), chooser = $('#widgets-chooser'),
selectSidebar = chooser.find('.widgets-chooser-sidebars'), selectSidebar = chooser.find('.widgets-chooser-sidebars'),
sidebars = $('div.widgets-sortables'), sidebars = $('div.widgets-sortables'),
isRTL = !! ( 'undefined' !== typeof isRtl && isRtl ), isRTL = !! ( 'undefined' !== typeof isRtl && isRtl );
margin = ( isRTL ? 'marginRight' : 'marginLeft' );
$('#widgets-right').children('.widgets-holder-wrap').children('.sidebar-name').click( function() { $('#widgets-right').children('.widgets-holder-wrap').children('.sidebar-name').click( function() {
var $this = $(this), parent = $this.parent(); var $this = $(this), parent = $this.parent();
@ -27,34 +26,30 @@ wpWidgets = {
$(this).parent().toggleClass('closed'); $(this).parent().toggleClass('closed');
}); });
sidebars.each(function(){
if ( $(this).parent().hasClass('inactive') )
return true;
var h = 50, H = $(this).children('.widget').length;
h = h + parseInt(H * 48, 10);
$(this).css( 'minHeight', h + 'px' );
});
$(document.body).bind('click.widgets-toggle', function(e){ $(document.body).bind('click.widgets-toggle', function(e){
var target = $(e.target), css = {}, widget, inside, w; var target = $(e.target), css = { 'z-index': 100 }, widget, inside, w;
if ( target.parents('.widget-top').length && ! target.parents('#available-widgets').length ) { if ( target.parents('.widget-top').length && ! target.parents('#available-widgets').length ) {
widget = target.closest('div.widget'); widget = target.closest('div.widget');
inside = widget.children('.widget-inside'); inside = widget.children('.widget-inside');
w = parseInt( widget.find('input.widget-width').val(), 10 ); targetWidth = parseInt( widget.find('input.widget-width').val(), 10 ),
widgetWidth = widget.width();
if ( inside.is(':hidden') ) { if ( inside.is(':hidden') ) {
if ( w > 250 && inside.closest('div.widgets-sortables').length ) { if ( targetWidth > 250 && ( targetWidth + 30 > widgetWidth ) && widget.closest('div.widgets-sortables').length ) {
if ( inside.closest('div.widget-liquid-right').length ) if ( widget.closest('div.widget-liquid-right').length ) {
css[margin] = 235 - w + 'px'; margin = isRTL ? 'margin-right' : 'margin-left';
widget.css(css); } else {
margin = isRTL ? 'margin-left' : 'margin-right';
}
css[ margin ] = widgetWidth - ( targetWidth + 30 ) + 'px';
widget.css( css );
} }
wpWidgets.fixLabels(widget);
inside.slideDown('fast'); inside.slideDown('fast');
} else { } else {
inside.slideUp('fast', function() { inside.slideUp('fast', function() {
widget.css({'width':'', margin:''}); widget.attr( 'style', '' );
}); });
} }
e.preventDefault(); e.preventDefault();
@ -104,7 +99,6 @@ wpWidgets = {
containment: 'document', containment: 'document',
start: function(e,ui) { start: function(e,ui) {
ui.item.children('.widget-inside').hide(); ui.item.children('.widget-inside').hide();
ui.item.css({margin:'', 'width':''});
}, },
stop: function(e,ui) { stop: function(e,ui) {
if ( ui.item.hasClass('ui-draggable') && ui.item.data('draggable') ) if ( ui.item.hasClass('ui-draggable') && ui.item.data('draggable') )
@ -121,7 +115,7 @@ wpWidgets = {
id = the_id, id = the_id,
sb = $(this).attr('id'); sb = $(this).attr('id');
ui.item.css({margin:'', 'width':''}); ui.item.attr( 'style', '' );
the_id = ''; the_id = '';
if ( add ) { if ( add ) {
@ -258,8 +252,6 @@ wpWidgets = {
$.post( ajaxurl, a, function() { $.post( ajaxurl, a, function() {
$('.spinner').hide(); $('.spinner').hide();
}); });
this.resize();
}, },
save : function(widget, del, animate, order) { save : function(widget, del, animate, order) {
@ -298,14 +290,12 @@ wpWidgets = {
}); });
} else { } else {
widget.remove(); widget.remove();
wpWidgets.resize();
} }
} else { } else {
$('.spinner').hide(); $('.spinner').hide();
if ( r && r.length > 2 ) { if ( r && r.length > 2 ) {
$('div.widget-content', widget).html(r); $('div.widget-content', widget).html(r);
wpWidgets.appendTitle(widget); wpWidgets.appendTitle(widget);
wpWidgets.fixLabels(widget);
} }
} }
if ( order ) if ( order )
@ -324,28 +314,9 @@ wpWidgets = {
}, },
resize : function() {
$('div.widgets-sortables').each(function(){
if ( $(this).parent().hasClass('inactive') )
return true;
var h = 50, H = $(this).children('.widget').length;
h = h + parseInt(H * 48, 10);
$(this).css( 'minHeight', h + 'px' );
});
},
fixLabels : function(widget) {
widget.children('.widget-inside').find('label').each(function(){
var f = $(this).attr('for');
if ( f && f === $('input', this).attr('id') )
$(this).removeAttr('for');
});
},
close : function(widget) { close : function(widget) {
widget.children('.widget-inside').slideUp('fast', function(){ widget.children('.widget-inside').slideUp('fast', function() {
widget.css({'width':'', margin:''}); widget.attr( 'style', '' );
}); });
}, },

File diff suppressed because one or more lines are too long