Make WordPress Core

Changeset 41684


Ignore:
Timestamp:
10/02/2017 09:51:09 PM (7 years ago)
Author:
afercia
Message:

Quick/Bulk Edit: Improve the inline error messages styling.

  • uses the core notice styles for the Quick Edit form inline error messages
  • adds missing periods at the end of a few error messages

Props ocean90, karmatosed, melchoyce, afercia.
Fixes #35496.

Location:
trunk
Files:
12 edited

Legend:

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

    r41563 r41684  
    286286}
    287287
    288 .inline-edit-row p.submit {
     288.inline-edit-row .submit {
    289289    zoom: 100%;
    290290}
  • trunk/src/wp-admin/css/list-tables.css

    r41648 r41684  
    151151    padding: 5px 7px 10px;
    152152    overflow: hidden;
    153     text-align: center;
    154153}
    155154
    156155#replysubmit .button {
    157156    margin-right: 5px;
    158 }
    159 
    160 #replysubmit .error {
    161     color: red;
    162     line-height: 21px;
    163     text-align: center;
    164157}
    165158
     
    958951}
    959952
    960 .inline-edit-row p.submit {
     953.inline-edit-row .submit {
    961954    clear: both;
    962955    padding: 0.5em;
     
    964957}
    965958
    966 .inline-edit-row span.error {
    967     line-height: 22px;
    968     margin: 0 15px;
    969     padding: 3px 5px;
     959.inline-edit-row .notice-error {
     960    margin-top: 1em;
     961}
     962
     963.inline-edit-row .notice-error .error {
     964    margin: 0.5em 0;
     965    padding: 2px;
    970966}
    971967
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r41683 r41684  
    17381738        }
    17391739    ?>
    1740         <p class="submit inline-edit-save">
     1740        <div class="submit inline-edit-save">
    17411741            <button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button>
    17421742            <?php if ( ! $bulk ) {
     
    17531753                <input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
    17541754            <?php } ?>
    1755             <span class="error" style="display:none"></span>
    17561755            <br class="clear" />
    1757         </p>
     1756            <div class="notice notice-error notice-alt inline hidden">
     1757                <p class="error"></p>
     1758            </div>
     1759        </div>
    17581760        </td></tr>
    17591761    <?php
  • trunk/src/wp-admin/includes/class-wp-terms-list-table.php

    r41161 r41684  
    617617    ?>
    618618
    619         <p class="inline-edit-save submit">
     619        <div class="inline-edit-save submit">
    620620            <button type="button" class="cancel button alignleft"><?php _e( 'Cancel' ); ?></button>
    621621            <button type="button" class="save button button-primary alignright"><?php echo $tax->labels->update_item; ?></button>
    622622            <span class="spinner"></span>
    623             <span class="error" style="display:none;"></span>
    624623            <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
    625624            <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" />
    626625            <input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" />
    627626            <br class="clear" />
    628         </p>
     627            <div class="notice notice-error notice-alt inline hidden">
     628                <p class="error"></p>
     629            </div>
     630        </div>
    629631        </td></tr>
    630632        </tbody></table></form>
  • trunk/src/wp-admin/includes/template.php

    r41399 r41684  
    424424    </div>
    425425
    426     <p id="replysubmit" class="submit">
    427     <a href="#comments-form" class="save button button-primary alignright">
    428     <span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span>
    429     <span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
    430     <span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
    431     <a href="#comments-form" class="cancel button alignleft"><?php _e('Cancel'); ?></a>
    432     <span class="waiting spinner"></span>
    433     <span class="error" style="display:none;"></span>
    434     </p>
     426    <div id="replysubmit" class="submit">
     427        <p>
     428            <a href="#comments-form" class="save button button-primary alignright">
     429                <span id="addbtn" style="display: none;"><?php _e( 'Add Comment' ); ?></span>
     430                <span id="savebtn" style="display: none;"><?php _e( 'Update Comment' ); ?></span>
     431                <span id="replybtn" style="display: none;"><?php _e( 'Submit Reply' ); ?></span>
     432            </a>
     433            <a href="#comments-form" class="cancel button alignleft"><?php _e( 'Cancel' ); ?></a>
     434            <span class="waiting spinner"></span>
     435        </p>
     436        <br class="clear" />
     437        <div class="notice notice-error notice-alt inline hidden">
     438            <p class="error"></p>
     439        </div>
     440    </div>
    435441
    436442    <input type="hidden" name="action" id="action" value="" />
     
    893899 *                                              (such as a post type, 'link', or 'comment'). Accepts a single
    894900 *                                              screen ID, WP_Screen object, or array of screen IDs. Default
    895  *                                              is the current screen.  If you have used add_menu_page() or 
     901 *                                              is the current screen.  If you have used add_menu_page() or
    896902 *                                              add_submenu_page() to create a new screen (and hence screen_id),
    897903 *                                              make sure your menu slug conforms to the limits of sanitize_key()
  • trunk/src/wp-admin/js/edit-comments.js

    r40297 r41684  
    654654        $('#replycontent').css('height', '').val('');
    655655        $('#edithead input').val('');
    656         $('.error', replyrow).empty().hide();
     656        $( '.notice-error', replyrow )
     657            .addClass( 'hidden' )
     658            .find( '.error' ).empty();
    657659        $( '.spinner', replyrow ).removeClass( 'is-active' );
    658660
     
    755757
    756758    send : function() {
    757         var post = {};
    758 
    759         $('#replysubmit .error').hide();
     759        var post = {},
     760            $errorNotice = $( '#replysubmit .error-notice' );
     761
     762        $errorNotice.addClass( 'hidden' );
    760763        $( '#replysubmit .spinner' ).addClass( 'is-active' );
    761764
     
    848851
    849852    error : function(r) {
    850         var er = r.statusText;
     853        var er = r.statusText,
     854            $errorNotice = $( '#replysubmit .notice-error' ),
     855            $error = $errorNotice.find( '.error' );
    851856
    852857        $( '#replysubmit .spinner' ).removeClass( 'is-active' );
     
    855860            er = r.responseText.replace( /<.[^<>]*?>/g, '' );
    856861
    857         if ( er )
    858             $('#replysubmit .error').html(er).show();
    859 
     862        if ( er ) {
     863            $errorNotice.removeClass( 'hidden' );
     864            $error.html( er );
     865        }
    860866    },
    861867
  • trunk/src/wp-admin/js/inline-edit-post.js

    r40796 r41684  
    414414        $.post( ajaxurl, params,
    415415            function(r) {
    416                 var $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' );
     416                var $errorNotice = $( '#edit-' + id + ' .inline-edit-save .notice-error' ),
     417                    $error = $errorNotice.find( '.error' );
    417418
    418419                $( 'table.widefat .spinner' ).removeClass( 'is-active' );
     
    430431                    } else {
    431432                        r = r.replace( /<.[^<>]*?>/g, '' );
    432                         $errorSpan.html( r ).show();
    433                         wp.a11y.speak( $errorSpan.text() );
     433                        $errorNotice.removeClass( 'hidden' );
     434                        $error.html( r );
     435                        wp.a11y.speak( $error.text() );
    434436                    }
    435437                } else {
    436                     $errorSpan.html( inlineEditL10n.error ).show();
     438                    $errorNotice.removeClass( 'hidden' );
     439                    $error.html( inlineEditL10n.error );
    437440                    wp.a11y.speak( inlineEditL10n.error );
    438441                }
  • trunk/src/wp-admin/js/inline-edit-tax.js

    r38644 r41684  
    197197            function(r) {
    198198                var row, new_id, option_value,
    199                     $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' );
     199                    $errorNotice = $( '#edit-' + id + ' .inline-edit-save .notice-error' ),
     200                    $error = $errorNotice.find( '.error' );
    200201
    201202                $( 'table.widefat .spinner' ).removeClass( 'is-active' );
     
    226227
    227228                    } else {
    228                         $errorSpan.html( r ).show();
     229                        $errorNotice.removeClass( 'hidden' );
     230                        $error.html( r );
    229231                        /*
    230232                         * Some error strings may contain HTML entities (e.g. `&#8220`), let's use
    231233                         * the HTML element's text.
    232234                         */
    233                         wp.a11y.speak( $errorSpan.text() );
     235                        wp.a11y.speak( $error.text() );
    234236                    }
    235237                } else {
    236                     $errorSpan.html( inlineEditL10n.error ).show();
     238                    $errorNotice.removeClass( 'hidden' );
     239                    $error.html( inlineEditL10n.error );
    237240                    wp.a11y.speak( inlineEditL10n.error );
    238241                }
  • trunk/src/wp-includes/taxonomy.php

    r41674 r41684  
    425425    // Do not allow unregistering internal taxonomies.
    426426    if ( $taxonomy_object->_builtin ) {
    427         return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed' ) );
     427        return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed.' ) );
    428428    }
    429429
     
    747747function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
    748748    if ( empty( $term ) ) {
    749         return new WP_Error( 'invalid_term', __( 'Empty Term' ) );
     749        return new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
    750750    }
    751751
     
    21242124
    21252125    if ( false === $wpdb->insert( $wpdb->terms, $data ) ) {
    2126         return new WP_Error( 'db_insert_error', __( 'Could not insert term into the database' ), $wpdb->last_error );
     2126        return new WP_Error( 'db_insert_error', __( 'Could not insert term into the database.' ), $wpdb->last_error );
    21272127    }
    21282128
     
    23482348        if ( $values )
    23492349            if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)" ) )
    2350                 return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error );
     2350                return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database.' ), $wpdb->last_error );
    23512351    }
    23522352
     
    26162616
    26172617    if ( ! $term ) {
    2618         return new WP_Error( 'invalid_term', __( 'Empty Term' ) );
     2618        return new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
    26192619    }
    26202620
     
    27022702        } else {
    27032703            /* translators: 1: Taxonomy term slug */
    2704             return new WP_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
     2704            return new WP_Error( 'duplicate_term_slug', sprintf( __( 'The slug &#8220;%s&#8221; is already in use by another term.' ), $slug ) );
    27052705        }
    27062706    }
     
    39173917
    39183918    if ( !is_object($term) )
    3919         $term = new WP_Error('invalid_term', __('Empty Term'));
     3919        $term = new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
    39203920
    39213921    if ( is_wp_error( $term ) )
     
    41294129function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
    41304130    if ( !$object_id = (int) $object_id )
    4131         return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );
     4131        return new WP_Error( 'invalid_object', __( 'Invalid object ID.' ) );
    41324132
    41334133    $object_terms = get_object_term_cache( $object_id, $taxonomy );
  • trunk/tests/phpunit/tests/xmlrpc/wp/deleteTerm.php

    r40417 r41684  
    5252        $this->assertIXRError( $result );
    5353        $this->assertEquals( 500, $result->code );
    54         $this->assertEquals( __('Empty Term'), $result->message );
     54        $this->assertEquals( __('Empty Term.'), $result->message );
    5555    }
    5656
  • trunk/tests/phpunit/tests/xmlrpc/wp/editTerm.php

    r41575 r41684  
    6969        $this->assertIXRError( $result );
    7070        $this->assertEquals( 500, $result->code );
    71         $this->assertEquals( __('Empty Term'), $result->message );
     71        $this->assertEquals( __('Empty Term.'), $result->message );
    7272    }
    7373
     
    134134        $this->assertIXRError( $result );
    135135        $this->assertEquals( 500, $result->code );
    136         $this->assertEquals( htmlspecialchars( sprintf( __('The slug &#8220;%s&#8221; is already in use by another term'), $parent_term->slug ) ), $result->message );
     136        $this->assertEquals( htmlspecialchars( sprintf( __('The slug &#8220;%s&#8221; is already in use by another term.'), $parent_term->slug ) ), $result->message );
    137137    }
    138138
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTerm.php

    r40916 r41684  
    5454        $this->assertIXRError( $result );
    5555        $this->assertEquals( 500, $result->code );
    56         $this->assertEquals( __('Empty Term'), $result->message );
     56        $this->assertEquals( __('Empty Term.'), $result->message );
    5757    }
    5858
Note: See TracChangeset for help on using the changeset viewer.