Fix postbox containers when there are no visible postboxes in them, fixes #18882
git-svn-id: https://develop.svn.wordpress.org/trunk@18924 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
34e570a8ab
commit
692d11e622
File diff suppressed because one or more lines are too long
|
@ -2069,6 +2069,10 @@ body.admin-bar #adminmenu {
|
|||
float: left;
|
||||
}
|
||||
|
||||
.postbox-container .meta-box-sortables {
|
||||
min-height: 350px;
|
||||
}
|
||||
|
||||
.postbox-container .meta-box-sortables.empty-container,
|
||||
#side-sortables.empty-container {
|
||||
border: 3px dashed #CCCCCC;
|
||||
|
|
|
@ -48,7 +48,7 @@ var postboxes;
|
|||
});
|
||||
|
||||
$('.columns-prefs input[type="radio"]').click(function(){
|
||||
var num = $(this).val(), i, el, done, ps = $('#poststuff');
|
||||
var num = $(this).val(), i, el, done, ps = $('#poststuff'), move;
|
||||
|
||||
num = parseInt(num, 10);
|
||||
|
||||
|
@ -83,18 +83,21 @@ var postboxes;
|
|||
if ( el.parent().is(':hidden') ) {
|
||||
switch ( i ) {
|
||||
case 4:
|
||||
if ( $('#column3-sortables .postbox').length > 1 ) {
|
||||
el.append( $('#column3-sortables .postbox').last() );
|
||||
move = $('.postbox:visible', $('#column3-sortables'));
|
||||
if ( move.length > 1 ) {
|
||||
el.append( move.last() );
|
||||
done = true;
|
||||
}
|
||||
case 3:
|
||||
if ( !done && $('#side-sortables .postbox').length > 1 ) {
|
||||
el.append( $('#side-sortables .postbox').last() );
|
||||
move = $('.postbox:visible', $('#side-sortables'));
|
||||
if ( !done && move.length > 1 ) {
|
||||
el.append( move.last() );
|
||||
done = true;
|
||||
}
|
||||
case 2:
|
||||
if ( !done && $('#normal-sortables .postbox').length > 1 ) {
|
||||
el.append( $('#normal-sortables .postbox').last() );
|
||||
move = $('.postbox:visible', $('#normal-sortables'));
|
||||
if ( !done && move.length > 1 ) {
|
||||
el.append( move.last() );
|
||||
done = true;
|
||||
}
|
||||
default:
|
||||
|
@ -139,16 +142,10 @@ var postboxes;
|
|||
if ( 'dashboard_browser_nag' == ui.item[0].id )
|
||||
$(ui.sender).sortable('cancel');
|
||||
|
||||
$.each($('.postbox-container:visible'), function(n, el){
|
||||
var first = $('.meta-box-sortables:first', el);
|
||||
|
||||
if ( !first.children('.postbox:visible').length )
|
||||
first.addClass('empty-container');
|
||||
else
|
||||
first.removeClass('empty-container');
|
||||
});
|
||||
postboxes._mark_area();
|
||||
}
|
||||
});
|
||||
this._mark_area();
|
||||
},
|
||||
|
||||
save_state : function(page) {
|
||||
|
@ -197,6 +194,17 @@ var postboxes;
|
|||
return '';
|
||||
}
|
||||
},
|
||||
|
||||
_mark_area : function() {
|
||||
$('#side-info-column .meta-box-sortables:visible, #dashboard-widgets .meta-box-sortables:visible').each(function(n, el){
|
||||
var t = $(this);
|
||||
|
||||
if ( !t.children('.postbox:visible').length )
|
||||
t.addClass('empty-container');
|
||||
else
|
||||
t.removeClass('empty-container');
|
||||
});
|
||||
},
|
||||
|
||||
/* Callbacks */
|
||||
pbshow : false,
|
||||
|
|
|
@ -1 +1 @@
|
|||
var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var d=a(this).parent(".postbox"),e=d.attr("id");if("dashboard_browser_nag"==e){return}d.toggleClass("closed");postboxes.save_state(c);if(e){if(!d.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}else{if(d.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}}});a(".postbox h3 a").click(function(d){d.stopPropagation()});a(".postbox a.dismiss").click(function(f){var d=a(this).parents(".postbox").attr("id")+"-hide";a("#"+d).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").click(function(){var d=a(this).val();if(a(this).prop("checked")){a("#"+d).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(d)}}else{a("#"+d).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(d)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var e=a(this).val(),f,g,d,h=a("#poststuff");e=parseInt(e,10);if(h.length){if(e==2){a(".wrap").removeClass("columns-1").addClass("columns-2");h.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}}else{if(e==1){a(".wrap").removeClass("columns-2").addClass("columns-1");h.removeClass("has-right-sidebar");if(!a("#post-body-content #side-sortables").length){a("#normal-sortables").before(a("#side-sortables"))}}}}else{for(f=4;(f>e&&f>1);f--){g=a("#"+postboxes._colname(f)+"-sortables");a("#"+postboxes._colname(f-1)+"-sortables").append(g.children(".postbox"));g.parent().hide()}for(f=e;f>0;f--){g=a("#"+postboxes._colname(f)+"-sortables");d=false;if(g.parent().is(":hidden")){switch(f){case 4:if(a("#column3-sortables .postbox").length>1){g.append(a("#column3-sortables .postbox").last());d=true}case 3:if(!d&&a("#side-sortables .postbox").length>1){g.append(a("#side-sortables .postbox").last());d=true}case 2:if(!d&&a("#normal-sortables .postbox").length>1){g.append(a("#normal-sortables .postbox").last());d=true}default:if(!d){g.addClass("empty-container")}}g.parent().show()}}a(".postbox-container:visible").css("width",100/e+"%")}postboxes.save_order(c)})},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c);d.item.parent().removeClass("temp-border")},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}a.each(a(".postbox-container:visible"),function(h,e){var g=a(".meta-box-sortables:first",e);if(!g.children(".postbox:visible").length){g.addClass("empty-container")}else{g.removeClass("empty-container")}})}})},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b)},_colname:function(b){switch(b){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}},pbshow:false,pbhide:false}}(jQuery));
|
||||
var postboxes;(function(a){postboxes={add_postbox_toggles:function(c,b){this.init(c,b);a(".postbox h3, .postbox .handlediv").click(function(){var d=a(this).parent(".postbox"),e=d.attr("id");if("dashboard_browser_nag"==e){return}d.toggleClass("closed");postboxes.save_state(c);if(e){if(!d.hasClass("closed")&&a.isFunction(postboxes.pbshow)){postboxes.pbshow(e)}else{if(d.hasClass("closed")&&a.isFunction(postboxes.pbhide)){postboxes.pbhide(e)}}}});a(".postbox h3 a").click(function(d){d.stopPropagation()});a(".postbox a.dismiss").click(function(f){var d=a(this).parents(".postbox").attr("id")+"-hide";a("#"+d).prop("checked",false).triggerHandler("click");return false});a(".hide-postbox-tog").click(function(){var d=a(this).val();if(a(this).prop("checked")){a("#"+d).show();if(a.isFunction(postboxes.pbshow)){postboxes.pbshow(d)}}else{a("#"+d).hide();if(a.isFunction(postboxes.pbhide)){postboxes.pbhide(d)}}postboxes.save_state(c)});a('.columns-prefs input[type="radio"]').click(function(){var f=a(this).val(),g,h,e,j=a("#poststuff"),d;f=parseInt(f,10);if(j.length){if(f==2){a(".wrap").removeClass("columns-1").addClass("columns-2");j.addClass("has-right-sidebar");if(!a("#side-info-column #side-sortables").length){a("#side-info-column").append(a("#side-sortables"))}}else{if(f==1){a(".wrap").removeClass("columns-2").addClass("columns-1");j.removeClass("has-right-sidebar");if(!a("#post-body-content #side-sortables").length){a("#normal-sortables").before(a("#side-sortables"))}}}}else{for(g=4;(g>f&&g>1);g--){h=a("#"+postboxes._colname(g)+"-sortables");a("#"+postboxes._colname(g-1)+"-sortables").append(h.children(".postbox"));h.parent().hide()}for(g=f;g>0;g--){h=a("#"+postboxes._colname(g)+"-sortables");e=false;if(h.parent().is(":hidden")){switch(g){case 4:d=a(".postbox:visible",a("#column3-sortables"));if(d.length>1){h.append(d.last());e=true}case 3:d=a(".postbox:visible",a("#side-sortables"));if(!e&&d.length>1){h.append(d.last());e=true}case 2:d=a(".postbox:visible",a("#normal-sortables"));if(!e&&d.length>1){h.append(d.last());e=true}default:if(!e){h.addClass("empty-container")}}h.parent().show()}}a(".postbox-container:visible").css("width",100/f+"%")}postboxes.save_order(c)})},init:function(c,b){a.extend(this,b||{});a("#wpbody-content").css("overflow","hidden");a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",distance:2,tolerance:"pointer",forcePlaceholderSize:true,helper:"clone",opacity:0.65,stop:function(f,d){if(a(this).find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id){a(this).sortable("cancel");return}postboxes.save_order(c);d.item.parent().removeClass("temp-border")},receive:function(f,d){if("dashboard_browser_nag"==d.item[0].id){a(d.sender).sortable("cancel")}postboxes._mark_area()}});this._mark_area()},save_state:function(d){var b=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),c=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"closed-postboxes",closed:b,hidden:c,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:d})},save_order:function(c){var b,d=a(".columns-prefs input:checked").val()||0;b={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:c};a(".meta-box-sortables").each(function(){b["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b)},_colname:function(b){switch(b){case 1:return"normal";break;case 2:return"side";break;case 3:return"column3";break;case 4:return"column4";break;default:return""}},_mark_area:function(){a("#side-info-column .meta-box-sortables:visible, #dashboard-widgets .meta-box-sortables:visible").each(function(d,c){var b=a(this);if(!b.children(".postbox:visible").length){b.addClass("empty-container")}else{b.removeClass("empty-container")}})},pbshow:false,pbhide:false}}(jQuery));
|
|
@ -305,7 +305,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
|
||||
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20110524', 1 );
|
||||
|
||||
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20111005', 1 );
|
||||
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20111008', 1 );
|
||||
|
||||
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110524', 1 );
|
||||
$scripts->add_script_data( 'post', 'postL10n', array(
|
||||
|
@ -431,7 +431,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(), '20111007a' );
|
||||
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20111008' );
|
||||
|
||||
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20110919' );
|
||||
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
|
||||
|
|
Loading…
Reference in New Issue