WordPress.org

Make WordPress Core

Changeset 30505


Ignore:
Timestamp:
11/21/2014 04:40:29 PM (6 years ago)
Author:
helen
Message:

Admin notices: Add more variety and make more generically usable.

There is now a base class of notice, with additional classes of notice-success, notice-warning, notice-error, and a new blue notice-info.

Also corrects some misleading notice colors, such as plugin tested up to warnings and login messages.

props avryl, melchoyce.
fixes #27418.

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/common.css

    r30343 r30505  
    551551}
    552552
    553 div.updated,
    554 div.error {
    555     padding: 0 0.6em;
    556     margin: 5px 15px 2px;
    557 }
    558 
    559 div.updated p,
    560 div.error p {
    561     margin: 0.5em 0;
    562     padding: 2px;
    563 }
    564 
    565 .wrap div.updated,
    566 .wrap div.error,
    567 .media-upload-form div.error {
    568     margin: 5px 0 15px;
    569 }
    570 
    571 div.updated {
    572     border-left: 4px solid #7ad03a;
    573     padding: 1px 12px;
    574     background-color: #fff;
    575     -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
    576     box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
    577 }
    578 
    579 div.error {
    580     border-left: 4px solid #dd3d36;
    581     background: #fff;
    582     -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
    583     box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
    584     padding: 1px 12px;
    585 }
    586 
    587553.attention {
    588554    color: #2ea2cc;
     
    12481214}
    12491215
    1250 
    12511216/*------------------------------------------------------------------------------
    12521217  4.0 - Notifications
    12531218------------------------------------------------------------------------------*/
     1219
     1220.notice,
     1221div.updated,
     1222div.error {
     1223    background: #fff;
     1224    border-left: 4px solid #fff;
     1225    -webkit-box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
     1226    box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
     1227    margin: 5px 15px 2px;
     1228    padding: 1px 12px;
     1229}
     1230
     1231.notice p,
     1232div.updated p,
     1233div.error p {
     1234    margin: 0.5em 0;
     1235    padding: 2px;
     1236}
     1237
     1238.notice-success,
     1239div.updated {
     1240     border-color: #7ad03a;
     1241}
     1242
     1243.notice-warning {
     1244    border-color: #ffba00;
     1245}
     1246
     1247.notice-error,
     1248div.error {
     1249    border-color: #dd3d36;
     1250}
     1251
     1252.notice-info {
     1253    border-color: #2ea2cc;
     1254}
     1255
     1256.wrap .notice,
     1257.wrap div.updated,
     1258.wrap div.error,
     1259.media-upload-form .notice,
     1260.media-upload-form div.error {
     1261    margin: 5px 0 15px;
     1262}
    12541263
    12551264#update-nag,
  • trunk/src/wp-admin/css/login.css

    r29366 r30505  
    5555
    5656.login .message {
    57     border-left: 4px solid #7ad03a;
     57    border-left: 4px solid #2ea2cc;
    5858    padding: 1px 12px;
    5959    background-color: #fff;
  • trunk/src/wp-admin/edit-form-advanced.php

    r30350 r30505  
    389389?></h2>
    390390<?php if ( $notice ) : ?>
    391 <div id="notice" class="error"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
     391<div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
    392392<?php endif; ?>
    393393<?php if ( $message ) : ?>
  • trunk/src/wp-admin/includes/plugin-install.php

    r29882 r30505  
    505505    <?php
    506506        if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
    507             echo '<div class="error"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
     507            echo '<div class="notice notice-warning"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
    508508        } else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
    509             echo '<div class="error"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';
     509            echo '<div class="notice notice-warning"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';
    510510        }
    511511
  • trunk/src/wp-admin/includes/template.php

    r30332 r30505  
    20852085function _local_storage_notice() {
    20862086    ?>
    2087     <div id="local-storage-notice" class="hidden">
     2087    <div id="local-storage-notice" class="hidden notice">
    20882088    <p class="local-restore">
    20892089        <?php _e('The backup of this post in your browser is different from the version below.'); ?>
  • trunk/src/wp-includes/js/autosave.js

    r29572 r30505  
    346346
    347347                $notice = $( '#local-storage-notice' );
    348                 $('.wrap h2').first().after( $notice.addClass( 'updated' ).show() );
     348                $('.wrap h2').first().after( $notice.addClass( 'notice-warning' ).show() );
    349349
    350350                $notice.on( 'click.autosave-local', function( event ) {
     
    355355                        $target.parent().hide();
    356356                        $(this).find( 'p.undo-restore' ).show();
     357                        $notice.removeClass( 'notice-warning' ).addClass( 'notice-success' );
    357358                    } else if ( $target.hasClass( 'undo-restore-backup' ) ) {
    358359                        restorePost( undoPostData );
    359360                        $target.parent().hide();
    360361                        $(this).find( 'p.local-restore' ).show();
     362                        $notice.removeClass( 'notice-success' ).addClass( 'notice-warning' );
    361363                    }
    362364
Note: See TracChangeset for help on using the changeset viewer.