Make WordPress Core


Ignore:
Timestamp:
06/27/2021 03:55:21 PM (3 years ago)
Author:
Clorith
Message:

Site Health: Add a unique wrapper for dashboard widget content.

This wraps the inner-content of the Site Health dashboard widget to give a unique target for CSS selectors, restoring the ability to collapse the widget.

The initial implementation targeted the .inside class used by all widgets to apply styling to the widget content, but this prevented the widget from being collapsed, as it added grid-styles which other widgets do not use, overriding the usual behavior when toggling widget visibility.

Follow-up to [50833].

Props alanjacobmathew, walbo.
Fixes #53521.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r51189 r51247  
    19101910    $issues_total = $issue_counts['recommended'] + $issue_counts['critical'];
    19111911    ?>
    1912     <div class="health-check-widget-title-section site-health-progress-wrapper loading hide-if-no-js">
    1913         <div class="site-health-progress">
    1914             <svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
    1915                 <circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
    1916                 <circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
    1917             </svg>
     1912    <div class="health-check-widget">
     1913        <div class="health-check-widget-title-section site-health-progress-wrapper loading hide-if-no-js">
     1914            <div class="site-health-progress">
     1915                <svg role="img" aria-hidden="true" focusable="false" width="100%" height="100%" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg">
     1916                    <circle r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
     1917                    <circle id="bar" r="90" cx="100" cy="100" fill="transparent" stroke-dasharray="565.48" stroke-dashoffset="0"></circle>
     1918                </svg>
     1919            </div>
     1920            <div class="site-health-progress-label">
     1921                <?php if ( false === $get_issues ) : ?>
     1922                    <?php _e( 'No information yet&hellip;' ); ?>
     1923                <?php else : ?>
     1924                    <?php _e( 'Results are still loading&hellip;' ); ?>
     1925                <?php endif; ?>
     1926            </div>
    19181927        </div>
    1919         <div class="site-health-progress-label">
     1928
     1929        <div class="site-health-details">
    19201930            <?php if ( false === $get_issues ) : ?>
    1921                 <?php _e( 'No information yet&hellip;' ); ?>
     1931                <p>
     1932                    <?php
     1933                    printf(
     1934                        /* translators: %s: URL to Site Health screen. */
     1935                        __( 'Site health checks will automatically run periodically to gather information about your site. You can also <a href="%s">visit the Site Health screen</a> to gather information about your site now.' ),
     1936                        esc_url( admin_url( 'site-health.php' ) )
     1937                    );
     1938                    ?>
     1939                </p>
    19221940            <?php else : ?>
    1923                 <?php _e( 'Results are still loading&hellip;' ); ?>
     1941                <p>
     1942                    <?php if ( $issues_total <= 0 ) : ?>
     1943                        <?php _e( 'Great job! Your site currently passes all site health checks.' ); ?>
     1944                    <?php elseif ( 1 === (int) $issue_counts['critical'] ) : ?>
     1945                        <?php _e( 'Your site has a critical issue that should be addressed as soon as possible to improve its performance and security.' ); ?>
     1946                    <?php elseif ( $issue_counts['critical'] > 1 ) : ?>
     1947                        <?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve its performance and security.' ); ?>
     1948                    <?php elseif ( 1 === (int) $issue_counts['recommended'] ) : ?>
     1949                        <?php _e( 'Your site&#8217;s health is looking good, but there is still one thing you can do to improve its performance and security.' ); ?>
     1950                    <?php else : ?>
     1951                        <?php _e( 'Your site&#8217;s health is looking good, but there are still some things you can do to improve its performance and security.' ); ?>
     1952                    <?php endif; ?>
     1953                </p>
     1954            <?php endif; ?>
     1955
     1956            <?php if ( $issues_total > 0 && false !== $get_issues ) : ?>
     1957                <p>
     1958                    <?php
     1959                    printf(
     1960                        /* translators: 1: Number of issues. 2: URL to Site Health screen. */
     1961                        _n(
     1962                            'Take a look at the <strong>%1$d item</strong> on the <a href="%2$s">Site Health screen</a>.',
     1963                            'Take a look at the <strong>%1$d items</strong> on the <a href="%2$s">Site Health screen</a>.',
     1964                            $issues_total
     1965                        ),
     1966                        $issues_total,
     1967                        esc_url( admin_url( 'site-health.php' ) )
     1968                    );
     1969                    ?>
     1970                </p>
    19241971            <?php endif; ?>
    19251972        </div>
    1926     </div>
    1927 
    1928     <div class="site-health-details">
    1929         <?php if ( false === $get_issues ) : ?>
    1930             <p>
    1931                 <?php
    1932                 printf(
    1933                     /* translators: %s: URL to Site Health screen. */
    1934                     __( 'Site health checks will automatically run periodically to gather information about your site. You can also <a href="%s">visit the Site Health screen</a> to gather information about your site now.' ),
    1935                     esc_url( admin_url( 'site-health.php' ) )
    1936                 );
    1937                 ?>
    1938             </p>
    1939         <?php else : ?>
    1940             <p>
    1941                 <?php if ( $issues_total <= 0 ) : ?>
    1942                     <?php _e( 'Great job! Your site currently passes all site health checks.' ); ?>
    1943                 <?php elseif ( 1 === (int) $issue_counts['critical'] ) : ?>
    1944                     <?php _e( 'Your site has a critical issue that should be addressed as soon as possible to improve its performance and security.' ); ?>
    1945                 <?php elseif ( $issue_counts['critical'] > 1 ) : ?>
    1946                     <?php _e( 'Your site has critical issues that should be addressed as soon as possible to improve its performance and security.' ); ?>
    1947                 <?php elseif ( 1 === (int) $issue_counts['recommended'] ) : ?>
    1948                     <?php _e( 'Your site&#8217;s health is looking good, but there is still one thing you can do to improve its performance and security.' ); ?>
    1949                 <?php else : ?>
    1950                     <?php _e( 'Your site&#8217;s health is looking good, but there are still some things you can do to improve its performance and security.' ); ?>
    1951                 <?php endif; ?>
    1952             </p>
    1953         <?php endif; ?>
    1954 
    1955         <?php if ( $issues_total > 0 && false !== $get_issues ) : ?>
    1956             <p>
    1957                 <?php
    1958                 printf(
    1959                     /* translators: 1: Number of issues. 2: URL to Site Health screen. */
    1960                     _n(
    1961                         'Take a look at the <strong>%1$d item</strong> on the <a href="%2$s">Site Health screen</a>.',
    1962                         'Take a look at the <strong>%1$d items</strong> on the <a href="%2$s">Site Health screen</a>.',
    1963                         $issues_total
    1964                     ),
    1965                     $issues_total,
    1966                     esc_url( admin_url( 'site-health.php' ) )
    1967                 );
    1968                 ?>
    1969             </p>
    1970         <?php endif; ?>
    19711973    </div>
    19721974
Note: See TracChangeset for help on using the changeset viewer.