From 02bd602dfe07f95a6db98080b6fea62946104570 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 3 Jul 2015 20:46:54 +0000 Subject: [PATCH] Improve the display of my-sites.php on small screens. Props tryon. Fixes #31685. git-svn-id: https://develop.svn.wordpress.org/trunk@33072 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/common.css | 123 ++++++++++++++++++++++++++++++++++++ src/wp-admin/my-sites.php | 58 ++++++----------- 2 files changed, 142 insertions(+), 39 deletions(-) diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css index 6bb2027aba..8b8535de1d 100644 --- a/src/wp-admin/css/common.css +++ b/src/wp-admin/css/common.css @@ -647,6 +647,7 @@ div#widgets-right .widget-top:hover, } .striped > tbody > :nth-child(odd), +ul.striped > :nth-child(odd), .alternate { background-color: #f9f9f9; } @@ -3039,6 +3040,128 @@ img { border-bottom: 1px solid #dfdfdf; } +/* My Sites */ +.my-sites { + display: block; + overflow: auto; + zoom: 1; + border: 1px solid #e5e5e5; +} + +.my-sites li { + display: block; + padding: 8px 1%; + margin: 0; +} + +@media only screen and (min-width: 600px) { + .my-sites.striped li { + background-color: #fff; + position: relative; + } + .my-sites.striped li:after { + content: ""; + width: 1px; + height: 100%; + position: absolute; + top: 0; + right: 0; + background: #ccc; + } + +} +@media only screen and (min-width: 600px) and (max-width: 699px) { + .my-sites li{ + float: left; + width: 48%; + } + .my-sites.striped li { + background-color: #fff; + } + .my-sites.striped li:nth-of-type(2n+2):after { + content: none; + } + .my-sites li:nth-of-type(4n+1), + .my-sites li:nth-of-type(4n+2) { + background-color: #f9f9f9; + } + +} + +@media only screen and (min-width: 700px) and (max-width: 1199px) { + .my-sites li { + float: left; + width: 31.333333%; + background-color: #fff; + } + .my-sites.striped li:nth-of-type(3n+3):after { + content: none; + } + .my-sites li:nth-of-type(6n+1), + .my-sites li:nth-of-type(6n+2), + .my-sites li:nth-of-type(6n+3) { + background-color: #f9f9f9; + } +} + +@media only screen and (min-width: 1200px) and (max-width: 1399px) { + .my-sites li { + float: left; + width: 23%; + background-color: #fff; + } + .my-sites.striped li:nth-of-type(4n+4):after { + content: none; + } + .my-sites li:nth-of-type(8n+1), + .my-sites li:nth-of-type(8n+2), + .my-sites li:nth-of-type(8n+3), + .my-sites li:nth-of-type(8n+4) { + background-color: #f9f9f9; + } +} + +@media only screen and (min-width: 1400px) and (max-width: 1599px) { + .my-sites li { + float: left; + width: 18%; + background-color: #fff; + } + .my-sites.striped li:nth-of-type(5n+5):after { + content: none; + } + .my-sites li:nth-of-type(10n+1), + .my-sites li:nth-of-type(10n+2), + .my-sites li:nth-of-type(10n+3), + .my-sites li:nth-of-type(10n+4), + .my-sites li:nth-of-type(10n+5) { + background-color: #f9f9f9; + } +} + +@media only screen and (min-width: 1600px) { + .my-sites li { + float: left; + width: 14.666666%; + background-color: #fff; + } + .my-sites.striped li:nth-of-type(6n+6):after { + content: none; + } + .my-sites li:nth-of-type(12n+1), + .my-sites li:nth-of-type(12n+2), + .my-sites li:nth-of-type(12n+3), + .my-sites li:nth-of-type(12n+4), + .my-sites li:nth-of-type(12n+5), + .my-sites li:nth-of-type(12n+6) { + background-color: #f9f9f9; + } +} + +.my-sites li a { + text-decoration: none; +} + /* =Media Queries -------------------------------------------------------------- */ diff --git a/src/wp-admin/my-sites.php b/src/wp-admin/my-sites.php index 011634fa7b..fbdd2cece4 100644 --- a/src/wp-admin/my-sites.php +++ b/src/wp-admin/my-sites.php @@ -68,14 +68,14 @@ else :
- + '; } reset( $blogs ); - $num = count( $blogs ); - $cols = 1; - if ( $num >= 20 ) - $cols = 4; - elseif ( $num >= 10 ) - $cols = 2; - $num_rows = ceil( $num / $cols ); - $split = 0; - for ( $i = 1; $i <= $num_rows; $i++ ) { - $rows[] = array_slice( $blogs, $split, $cols ); - $split = $split + $cols; - } - foreach ( $rows as $row ) { - echo ""; - $i = 0; - foreach ( $row as $user_blog ) { - $s = $i == 3 ? '' : 'border-right: 1px solid #ccc;'; - echo ""; - $i++; - } - echo ""; + foreach ( $blogs as $user_blog ) { + echo "
  • "; + echo "

    {$user_blog->blogname}

    "; + /** + * Filter the row links displayed for each site on the My Sites screen. + * + * @since MU + * + * @param string $string The HTML site link markup. + * @param object $user_blog An object containing the site data. + */ + echo "

    " . apply_filters( 'myblogs_blog_actions', "" . __( 'Visit' ) . " | " . __( 'Dashboard' ) . "", $user_blog ) . "

    "; + /** This filter is documented in wp-admin/my-sites.php */ + echo apply_filters( 'myblogs_options', '', $user_blog ); + echo "
  • "; }?> -

    ' . __( 'Global Settings' ) . '

    '; + echo '

    ' . __( 'Global Settings' ) . '

    '; echo $settings_html; - echo '
    "; - echo "

    {$user_blog->blogname}

    "; - /** - * Filter the row links displayed for each site on the My Sites screen. - * - * @since MU - * - * @param string $string The HTML site link markup. - * @param object $user_blog An object containing the site data. - */ - echo "

    " . apply_filters( 'myblogs_blog_actions', "" . __( 'Visit' ) . " | " . __( 'Dashboard' ) . "", $user_blog ) . "

    "; - /** This filter is documented in wp-admin/my-sites.php */ - echo apply_filters( 'myblogs_options', '', $user_blog ); - echo "
    +