Make WordPress Core

Changeset 41608


Ignore:
Timestamp:
09/27/2017 08:45:46 AM (7 years ago)
Author:
swissspidy
Message:

Plugins: Improve error messages on plugins screen.

This unifies the layout and wording of error messages on both the plugins screen and the themes screen.

Props tinkerbelly, juhise, Ankit K Gupta, m1tk00, swissspidy, mrahmadawais, danieltj.
Fixes #37430.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-plugin-install-list-table.php

    r41290 r41608  
    231231    public function no_items() {
    232232        if ( isset( $this->error ) ) {
    233             $message = $this->error->get_error_message() . '<p class="hide-if-no-js"><a href="#" class="button" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a></p>';
     233            echo '<div class="inline error"><p>' . $this->error->get_error_message() . '</p><p class="hide-if-no-js"><button class="button try-again">' . __( 'Try Again' ) . '</button></p></div>';
    234234        } else {
    235             $message = __( 'No plugins match your request.' );
    236         }
    237         echo '<div class="no-plugin-results">' . $message . '</div>';
     235            echo '<div class="no-plugin-results">' . __( 'No plugins found. Try a different search query.' ) . '</div>';
     236        }
    238237    }
    239238
  • trunk/src/wp-admin/js/theme.js

    r41337 r41608  
    16041604            $( 'body' ).removeClass( 'loading-content' );
    16051605            $( '.theme-browser' ).find( 'div.error' ).remove();
    1606             $( '.theme-browser' ).find( 'div.themes' ).before( '<div class="error"><p>' + l10n.error + '</p></div>' );
     1606            $( '.theme-browser' ).find( 'div.themes' ).before( '<div class="error"><p>' + l10n.error + '</p><p><button class="button try-again">' + l10n.tryAgain + '</button></p></div>' );
     1607            $( '.theme-browser .error .try-again' ).on( 'click', function( e ) {
     1608                e.preventDefault();
     1609                $( 'input.wp-filter-search' ).trigger( 'input' );
     1610            } );
    16071611        });
    16081612
  • trunk/src/wp-admin/js/updates.js

    r41585 r41608  
    22922292        } );
    22932293
     2294        /**
     2295         * Trigger a search event when the "Try Again" button is clicked.
     2296         *
     2297         * @since 4.8.0
     2298         */
     2299        $document.on( 'click', '.try-again', function( event ) {
     2300            event.preventDefault();
     2301            $pluginInstallSearch.trigger( 'input' );
     2302        } );
     2303
    22942304        /**
    22952305         * Trigger a search event when the search type gets changed.
  • trunk/src/wp-admin/theme-install.php

    r41289 r41608  
    5959            __( 'https://wordpress.org/support/' )
    6060        ),
     61        'tryAgain'            => __( 'Try Again' ),
    6162        'themesFound'         => __( 'Number of Themes found: %d' ),
    62         'noThemesFound'       => __( 'No themes found. Try a different search.' ),
     63        'noThemesFound'       => __( 'No themes found. Try a different search query.' ),
    6364        'collapseSidebar'     => __( 'Collapse Sidebar' ),
    6465        'expandSidebar'       => __( 'Expand Sidebar' ),
     
    228229    <div class="theme-install-overlay wp-full-overlay expanded"></div>
    229230
    230     <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
     231    <p class="no-themes"><?php _e( 'No themes found. Try a different search query.' ); ?></p>
    231232    <span class="spinner"></span>
    232233
  • trunk/src/wp-admin/themes.php

    r40586 r41608  
    140140        'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis)
    141141        'themesFound'       => __( 'Number of Themes found: %d' ),
    142         'noThemesFound'     => __( 'No themes found. Try a different search.' ),
     142        'noThemesFound'     => __( 'No themes found. Try a different search query.' ),
    143143    ),
    144144) );
     
    304304<div class="theme-overlay"></div>
    305305
    306 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
     306<p class="no-themes"><?php _e( 'No themes found. Try a different search query.' ); ?></p>
    307307
    308308<?php
  • trunk/src/wp-includes/script-loader.php

    r41597 r41608  
    813813                'nonceError'                 => __( 'An error has occurred. Please reload the page and try again.' ),
    814814                'pluginsFound'               => __( 'Number of plugins found: %d' ),
    815                 'noPluginsFound'             => __( 'No plugins found. Try a different search.' ),
     815                'noPluginsFound'             => __( 'No plugins found. Try a different search query.' ),
    816816            ),
    817817        ) );
Note: See TracChangeset for help on using the changeset viewer.