Dashboard columns:

* Improve responsive breakpoints for.
* Remove obsolete network admin option.
* Remove unnecessary JS.

props SergeyBiryukov, kraftbj, lessbloat. fixes #26074.

Built from https://develop.svn.wordpress.org/trunk@26392


git-svn-id: http://core.svn.wordpress.org/trunk@26292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2013-11-26 05:09:10 +00:00
parent c7bd838884
commit 2c9af1367e
8 changed files with 9 additions and 39 deletions

View File

@ -2440,7 +2440,7 @@ html.wp-toolbar {
} }
/* two columns on the dash, but keep the setting if one is selected */ /* two columns on the dash, but keep the setting if one is selected */
@media only screen and (min-width: 800px) and (max-width: 1399px) { @media only screen and (min-width: 800px) and (max-width: 1499px) {
#wpbody-content #dashboard-widgets .postbox-container { #wpbody-content #dashboard-widgets .postbox-container {
width: 49.5%; width: 49.5%;
} }
@ -2482,7 +2482,7 @@ html.wp-toolbar {
} }
/* three columns on the dash */ /* three columns on the dash */
@media only screen and (min-width: 1400px) and (max-width: 1800px) { @media only screen and (min-width: 1500px) and (max-width: 1800px) {
#wpbody-content #dashboard-widgets .postbox-container { #wpbody-content #dashboard-widgets .postbox-container {
width: 33.5%; width: 33.5%;
} }

File diff suppressed because one or more lines are too long

View File

@ -2440,7 +2440,7 @@ html.wp-toolbar {
} }
/* two columns on the dash, but keep the setting if one is selected */ /* two columns on the dash, but keep the setting if one is selected */
@media only screen and (min-width: 800px) and (max-width: 1399px) { @media only screen and (min-width: 800px) and (max-width: 1499px) {
#wpbody-content #dashboard-widgets .postbox-container { #wpbody-content #dashboard-widgets .postbox-container {
width: 49.5%; width: 49.5%;
} }
@ -2482,7 +2482,7 @@ html.wp-toolbar {
} }
/* three columns on the dash */ /* three columns on the dash */
@media only screen and (min-width: 1400px) and (max-width: 1800px) { @media only screen and (min-width: 1500px) and (max-width: 1800px) {
#wpbody-content #dashboard-widgets .postbox-container { #wpbody-content #dashboard-widgets .postbox-container {
width: 33.5%; width: 33.5%;
} }

File diff suppressed because one or more lines are too long

View File

@ -135,10 +135,9 @@ function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
*/ */
function wp_dashboard() { function wp_dashboard() {
$screen = get_current_screen(); $screen = get_current_screen();
$class = 'columns-' . get_current_screen()->get_columns();
?> ?>
<div id="dashboard-widgets" class="metabox-holder <?php echo $class; ?>"> <div id="dashboard-widgets" class="metabox-holder">
<div id='postbox-container-1' class='postbox-container'> <div id='postbox-container-1' class='postbox-container'>
<?php do_meta_boxes( $screen->id, 'normal', '' ); ?> <?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
</div> </div>

View File

@ -6,8 +6,7 @@ jQuery(document).ready( function($) {
welcomePanel = $( '#welcome-panel' ), welcomePanel = $( '#welcome-panel' ),
welcomePanelHide = $('#wp_welcome_panel-hide'), welcomePanelHide = $('#wp_welcome_panel-hide'),
updateWelcomePanel, updateWelcomePanel,
metaboxHolder = $( '.metabox-holder' ), metaboxHolder = $( '.metabox-holder' );
updateColumnCount;
updateWelcomePanel = function( visible ) { updateWelcomePanel = function( visible ) {
$.post( ajaxurl, { $.post( ajaxurl, {
@ -132,30 +131,4 @@ jQuery(document).ready( function($) {
e.preventDefault(); e.preventDefault();
}); });
updateColumnCount = function( $window, $holder ) {
var cols = 1,
windowWidth = parseInt( $window.width(), 10 );
if (799 < windowWidth && 1299 > windowWidth) {
cols = 2;
}
if (1300 < windowWidth && 1799 > windowWidth) {
cols = 3;
}
if (1800 < windowWidth) {
cols = 4;
}
$holder.attr( 'class', $holder.attr( 'class' ).replace( /columns-\d+/, 'columns-' + cols ) );
};
// Update main column count on load
updateColumnCount( $window, metaboxHolder );
$window.on( 'resize', _.debounce(function() {
updateColumnCount( $window, metaboxHolder );
}, 30 ) );
} ); } );

View File

@ -1 +1 @@
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){var b,c,d=a(window),e=a("#welcome-panel"),f=a("#wp_welcome_panel-hide"),g=a(".metabox-holder");b=function(b){a.post(ajaxurl,{action:"update-welcome-panel",visible:b,welcomepanelnonce:a("#welcomepanelnonce").val()})},e.hasClass("hidden")&&f.prop("checked")&&e.removeClass("hidden"),a(".welcome-panel-close, .welcome-panel-dismiss a",e).click(function(c){c.preventDefault(),e.addClass("hidden"),b(0),a("#wp_welcome_panel-hide").prop("checked",!1)}),f.click(function(){e.toggleClass("hidden",!this.checked),b(this.checked?1:0)}),ajaxWidgets=["dashboard_primary"],ajaxPopulateWidgets=function(b){function c(b,c){var d,e=a("#"+c+" div.inside:visible").find(".widget-loading");e.length&&(d=e.parent(),setTimeout(function(){d.load(ajaxurl+"?action=dashboard-widgets&widget="+c+"&pagenow="+pagenow,"",function(){d.hide().slideDown("normal",function(){a(this).css("display","")})})},500*b))}b?(b=b.toString(),-1!==a.inArray(b,ajaxWidgets)&&c(0,b)):a.each(ajaxWidgets,c)},ajaxPopulateWidgets(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),quickPressLoad=function(){var b,c=a("#quickpost-action");b=a("#quick-press").submit(function(){function c(){var b=a(".drafts ul li").first();b.css("background","#fffbe5"),setTimeout(function(){b.css("background","none")},1e3)}return a("#dashboard_quick_press #publishing-action .spinner").show(),a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),a.post(b.attr("action"),b.serializeArray(),function(b){a("#dashboard_quick_press .inside").html(b),a("#quick-press").removeClass("initial-form"),quickPressLoad(),c(),a("#title").focus()}),!1}),a("#publish").click(function(){c.val("post-quickpress-publish")}),a("#title, #tags-input, #content").each(function(){var b=a(this),c=a("#"+this.id+"-prompt-text");""===this.value&&c.removeClass("screen-reader-text"),c.click(function(){a(this).addClass("screen-reader-text"),b.focus()}),b.blur(function(){""===this.value&&c.removeClass("screen-reader-text")}),b.focus(function(){c.addClass("screen-reader-text")})}),a("#quick-press").on("click focusin",function(){a(this).addClass("quickpress-open"),a("#description-wrap, p.submit").slideDown(200),wpActiveEditor="content"})},quickPressLoad(),a(".meta-box-sortables").sortable("option","containment","#dashboard-widgets-wrap"),a(".show-more a").on("click",function(b){a(this).fadeOut().closest(".activity-block").find("li.hidden").fadeIn().removeClass("hidden"),b.preventDefault()}),c=function(a,b){var c=1,d=parseInt(a.width(),10);d>799&&1299>d&&(c=2),d>1300&&1799>d&&(c=3),d>1800&&(c=4),b.attr("class",b.attr("class").replace(/columns-\d+/,"columns-"+c))},c(d,g),d.on("resize",_.debounce(function(){c(d,g)},30))}); var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){var b,c=(a(window),a("#welcome-panel")),d=a("#wp_welcome_panel-hide");a(".metabox-holder"),b=function(b){a.post(ajaxurl,{action:"update-welcome-panel",visible:b,welcomepanelnonce:a("#welcomepanelnonce").val()})},c.hasClass("hidden")&&d.prop("checked")&&c.removeClass("hidden"),a(".welcome-panel-close, .welcome-panel-dismiss a",c).click(function(d){d.preventDefault(),c.addClass("hidden"),b(0),a("#wp_welcome_panel-hide").prop("checked",!1)}),d.click(function(){c.toggleClass("hidden",!this.checked),b(this.checked?1:0)}),ajaxWidgets=["dashboard_primary"],ajaxPopulateWidgets=function(b){function c(b,c){var d,e=a("#"+c+" div.inside:visible").find(".widget-loading");e.length&&(d=e.parent(),setTimeout(function(){d.load(ajaxurl+"?action=dashboard-widgets&widget="+c+"&pagenow="+pagenow,"",function(){d.hide().slideDown("normal",function(){a(this).css("display","")})})},500*b))}b?(b=b.toString(),-1!==a.inArray(b,ajaxWidgets)&&c(0,b)):a.each(ajaxWidgets,c)},ajaxPopulateWidgets(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),quickPressLoad=function(){var b,c=a("#quickpost-action");b=a("#quick-press").submit(function(){function c(){var b=a(".drafts ul li").first();b.css("background","#fffbe5"),setTimeout(function(){b.css("background","none")},1e3)}return a("#dashboard_quick_press #publishing-action .spinner").show(),a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),a.post(b.attr("action"),b.serializeArray(),function(b){a("#dashboard_quick_press .inside").html(b),a("#quick-press").removeClass("initial-form"),quickPressLoad(),c(),a("#title").focus()}),!1}),a("#publish").click(function(){c.val("post-quickpress-publish")}),a("#title, #tags-input, #content").each(function(){var b=a(this),c=a("#"+this.id+"-prompt-text");""===this.value&&c.removeClass("screen-reader-text"),c.click(function(){a(this).addClass("screen-reader-text"),b.focus()}),b.blur(function(){""===this.value&&c.removeClass("screen-reader-text")}),b.focus(function(){c.addClass("screen-reader-text")})}),a("#quick-press").on("click focusin",function(){a(this).addClass("quickpress-open"),a("#description-wrap, p.submit").slideDown(200),wpActiveEditor="content"})},quickPressLoad(),a(".meta-box-sortables").sortable("option","containment","#dashboard-widgets-wrap"),a(".show-more a").on("click",function(b){a(this).fadeOut().closest(".activity-block").find("li.hidden").fadeIn().removeClass("hidden"),b.preventDefault()})});

View File

@ -60,8 +60,6 @@ wp_enqueue_script( 'dashboard' );
wp_enqueue_script( 'plugin-install' ); wp_enqueue_script( 'plugin-install' );
add_thickbox(); add_thickbox();
add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
require_once( ABSPATH . 'wp-admin/admin-header.php' ); require_once( ABSPATH . 'wp-admin/admin-header.php' );
?> ?>