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.

Built from https://develop.svn.wordpress.org/trunk@41684


git-svn-id: http://core.svn.wordpress.org/trunk@41518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2017-10-02 21:52:52 +00:00
parent 6a6795382a
commit a42b9cebde
19 changed files with 87 additions and 73 deletions

View File

@ -285,7 +285,7 @@ table.fixed td {
width: 29%;
}
.inline-edit-row p.submit {
.inline-edit-row .submit {
zoom: 100%;
}

File diff suppressed because one or more lines are too long

View File

@ -285,7 +285,7 @@ table.fixed td {
width: 29%;
}
.inline-edit-row p.submit {
.inline-edit-row .submit {
zoom: 100%;
}

File diff suppressed because one or more lines are too long

View File

@ -150,19 +150,12 @@
margin: 0;
padding: 5px 7px 10px;
overflow: hidden;
text-align: center;
}
#replysubmit .button {
margin-left: 5px;
}
#replysubmit .error {
color: red;
line-height: 21px;
text-align: center;
}
#replyrow.inline-edit-row fieldset.comment-reply {
font-size: inherit;
line-height: inherit;
@ -957,16 +950,19 @@ tr.inline-edit-row td,
line-height: 2.5;
}
.inline-edit-row p.submit {
.inline-edit-row .submit {
clear: both;
padding: 0.5em;
margin: 0.5em 0 0;
}
.inline-edit-row span.error {
line-height: 22px;
margin: 0 15px;
padding: 3px 5px;
.inline-edit-row .notice-error {
margin-top: 1em;
}
.inline-edit-row .notice-error .error {
margin: 0.5em 0;
padding: 2px;
}
/* Positioning */

File diff suppressed because one or more lines are too long

View File

@ -150,19 +150,12 @@
margin: 0;
padding: 5px 7px 10px;
overflow: hidden;
text-align: center;
}
#replysubmit .button {
margin-right: 5px;
}
#replysubmit .error {
color: red;
line-height: 21px;
text-align: center;
}
#replyrow.inline-edit-row fieldset.comment-reply {
font-size: inherit;
line-height: inherit;
@ -957,16 +950,19 @@ tr.inline-edit-row td,
line-height: 2.5;
}
.inline-edit-row p.submit {
.inline-edit-row .submit {
clear: both;
padding: 0.5em;
margin: 0.5em 0 0;
}
.inline-edit-row span.error {
line-height: 22px;
margin: 0 15px;
padding: 3px 5px;
.inline-edit-row .notice-error {
margin-top: 1em;
}
.inline-edit-row .notice-error .error {
margin: 0.5em 0;
padding: 2px;
}
/* Positioning */

File diff suppressed because one or more lines are too long

View File

@ -1737,7 +1737,7 @@ class WP_Posts_List_Table extends WP_List_Table {
}
?>
<p class="submit inline-edit-save">
<div class="submit inline-edit-save">
<button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button>
<?php if ( ! $bulk ) {
wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
@ -1752,9 +1752,11 @@ class WP_Posts_List_Table extends WP_List_Table {
<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?>
<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
<?php } ?>
<span class="error" style="display:none"></span>
<br class="clear" />
</p>
<div class="notice notice-error notice-alt inline hidden">
<p class="error"></p>
</div>
</div>
</td></tr>
<?php
$bulk++;

View File

@ -616,16 +616,18 @@ class WP_Terms_List_Table extends WP_List_Table {
?>
<p class="inline-edit-save submit">
<div class="inline-edit-save submit">
<button type="button" class="cancel button alignleft"><?php _e( 'Cancel' ); ?></button>
<button type="button" class="save button button-primary alignright"><?php echo $tax->labels->update_item; ?></button>
<span class="spinner"></span>
<span class="error" style="display:none;"></span>
<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" />
<input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" />
<br class="clear" />
</p>
<div class="notice notice-error notice-alt inline hidden">
<p class="error"></p>
</div>
</div>
</td></tr>
</tbody></table></form>
<?php

View File

@ -423,15 +423,21 @@ function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $
</div>
</div>
<p id="replysubmit" class="submit">
<a href="#comments-form" class="save button button-primary alignright">
<span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span>
<span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
<span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
<a href="#comments-form" class="cancel button alignleft"><?php _e('Cancel'); ?></a>
<span class="waiting spinner"></span>
<span class="error" style="display:none;"></span>
</p>
<div id="replysubmit" class="submit">
<p>
<a href="#comments-form" class="save button button-primary alignright">
<span id="addbtn" style="display: none;"><?php _e( 'Add Comment' ); ?></span>
<span id="savebtn" style="display: none;"><?php _e( 'Update Comment' ); ?></span>
<span id="replybtn" style="display: none;"><?php _e( 'Submit Reply' ); ?></span>
</a>
<a href="#comments-form" class="cancel button alignleft"><?php _e( 'Cancel' ); ?></a>
<span class="waiting spinner"></span>
</p>
<br class="clear" />
<div class="notice notice-error notice-alt inline hidden">
<p class="error"></p>
</div>
</div>
<input type="hidden" name="action" id="action" value="" />
<input type="hidden" name="comment_ID" id="comment_ID" value="" />
@ -892,7 +898,7 @@ function wp_import_upload_form( $action ) {
* @param string|array|WP_Screen $screen Optional. The screen or screens on which to show the box
* (such as a post type, 'link', or 'comment'). Accepts a single
* screen ID, WP_Screen object, or array of screen IDs. Default
* is the current screen. If you have used add_menu_page() or
* is the current screen. If you have used add_menu_page() or
* add_submenu_page() to create a new screen (and hence screen_id),
* make sure your menu slug conforms to the limits of sanitize_key()
* otherwise the 'screen' menu may not correctly render on your page.

View File

@ -653,7 +653,9 @@ commentReply = {
$('#com-reply').append( replyrow );
$('#replycontent').css('height', '').val('');
$('#edithead input').val('');
$('.error', replyrow).empty().hide();
$( '.notice-error', replyrow )
.addClass( 'hidden' )
.find( '.error' ).empty();
$( '.spinner', replyrow ).removeClass( 'is-active' );
this.cid = '';
@ -754,9 +756,10 @@ commentReply = {
},
send : function() {
var post = {};
var post = {},
$errorNotice = $( '#replysubmit .error-notice' );
$('#replysubmit .error').hide();
$errorNotice.addClass( 'hidden' );
$( '#replysubmit .spinner' ).addClass( 'is-active' );
$('#replyrow input').not(':button').each(function() {
@ -847,16 +850,19 @@ commentReply = {
},
error : function(r) {
var er = r.statusText;
var er = r.statusText,
$errorNotice = $( '#replysubmit .notice-error' ),
$error = $errorNotice.find( '.error' );
$( '#replysubmit .spinner' ).removeClass( 'is-active' );
if ( r.responseText )
er = r.responseText.replace( /<.[^<>]*?>/g, '' );
if ( er )
$('#replysubmit .error').html(er).show();
if ( er ) {
$errorNotice.removeClass( 'hidden' );
$error.html( er );
}
},
addcomment: function(post_id) {

File diff suppressed because one or more lines are too long

View File

@ -413,7 +413,8 @@ var inlineEditPost;
// Make ajax request.
$.post( ajaxurl, params,
function(r) {
var $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' );
var $errorNotice = $( '#edit-' + id + ' .inline-edit-save .notice-error' ),
$error = $errorNotice.find( '.error' );
$( 'table.widefat .spinner' ).removeClass( 'is-active' );
$( '.ac_results' ).hide();
@ -429,11 +430,13 @@ var inlineEditPost;
});
} else {
r = r.replace( /<.[^<>]*?>/g, '' );
$errorSpan.html( r ).show();
wp.a11y.speak( $errorSpan.text() );
$errorNotice.removeClass( 'hidden' );
$error.html( r );
wp.a11y.speak( $error.text() );
}
} else {
$errorSpan.html( inlineEditL10n.error ).show();
$errorNotice.removeClass( 'hidden' );
$error.html( inlineEditL10n.error );
wp.a11y.speak( inlineEditL10n.error );
}
},

File diff suppressed because one or more lines are too long

View File

@ -196,7 +196,8 @@ inlineEditTax = {
*/
function(r) {
var row, new_id, option_value,
$errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' );
$errorNotice = $( '#edit-' + id + ' .inline-edit-save .notice-error' ),
$error = $errorNotice.find( '.error' );
$( 'table.widefat .spinner' ).removeClass( 'is-active' );
@ -225,15 +226,17 @@ inlineEditTax = {
});
} else {
$errorSpan.html( r ).show();
$errorNotice.removeClass( 'hidden' );
$error.html( r );
/*
* Some error strings may contain HTML entities (e.g. `&#8220`), let's use
* the HTML element's text.
*/
wp.a11y.speak( $errorSpan.text() );
wp.a11y.speak( $error.text() );
}
} else {
$errorSpan.html( inlineEditL10n.error ).show();
$errorNotice.removeClass( 'hidden' );
$error.html( inlineEditL10n.error );
wp.a11y.speak( inlineEditL10n.error );
}
}

View File

@ -1 +1 @@
window.wp=window.wp||{};var inlineEditTax;!function(a,b){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("data-wp-lists").substr(5),b.what="#"+b.type+"-",a("#the-list").on("click","a.editinline",function(){return inlineEditTax.edit(this),!1}),c.keyup(function(a){if(27===a.which)return inlineEditTax.revert()}),a(".cancel",c).click(function(){return inlineEditTax.revert()}),a(".save",c).click(function(){return inlineEditTax.save(this)}),a("input, select",c).keydown(function(a){if(13===a.which)return inlineEditTax.save(this)}),a('#posts-filter input[type="submit"]').mousedown(function(){b.revert()})},toggle:function(b){var c=this;"none"===a(c.what+c.getId(b)).css("display")?c.revert():c.edit(b)},edit:function(b){var c,d,e,f=this;return f.revert(),"object"==typeof b&&(b=f.getId(b)),c=a("#inline-edit").clone(!0),d=a("#inline_"+b),a("td",c).attr("colspan",a("th:visible, td:visible",".wp-list-table.widefat:first thead").length),a(f.what+b).hide().after(c).after('<tr class="hidden"></tr>'),e=a(".name",d),e.find("img").replaceWith(function(){return this.alt}),e=e.text(),a(':input[name="name"]',c).val(e),e=a(".slug",d),e.find("img").replaceWith(function(){return this.alt}),e=e.text(),a(':input[name="slug"]',c).val(e),a(c).attr("id","edit-"+b).addClass("inline-editor").show(),a(".ptitle",c).eq(0).focus(),!1},save:function(c){var d,e,f=a('input[name="taxonomy"]').val()||"";return"object"==typeof c&&(c=this.getId(c)),a("table.widefat .spinner").addClass("is-active"),d={action:"inline-save-tax",tax_type:this.type,tax_ID:c,taxonomy:f},e=a("#edit-"+c).find(":input").serialize(),d=e+"&"+a.param(d),a.post(ajaxurl,d,function(d){var e,f,g,h=a("#edit-"+c+" .inline-edit-save .error");a("table.widefat .spinner").removeClass("is-active"),d?-1!==d.indexOf("<tr")?(a(inlineEditTax.what+c).siblings("tr.hidden").addBack().remove(),f=a(d).attr("id"),a("#edit-"+c).before(d).remove(),f?(g=f.replace(inlineEditTax.type+"-",""),e=a("#"+f)):(g=c,e=a(inlineEditTax.what+c)),a("#parent").find("option[value="+g+"]").text(e.find(".row-title").text()),e.hide().fadeIn(400,function(){e.find(".editinline").focus(),b.a11y.speak(inlineEditL10n.saved)})):(h.html(d).show(),b.a11y.speak(h.text())):(h.html(inlineEditL10n.error).show(),b.a11y.speak(inlineEditL10n.error))}),!1},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");b&&(a("table.widefat .spinner").removeClass("is-active"),a("#"+b).siblings("tr.hidden").addBack().remove(),b=b.substr(b.lastIndexOf("-")+1),a(this.what+b).show().find(".editinline").focus())},getId:function(b){var c="TR"===b.tagName?b.id:a(b).parents("tr").attr("id"),d=c.split("-");return d[d.length-1]}},a(document).ready(function(){inlineEditTax.init()})}(jQuery,window.wp);
window.wp=window.wp||{};var inlineEditTax;!function(a,b){inlineEditTax={init:function(){var b=this,c=a("#inline-edit");b.type=a("#the-list").attr("data-wp-lists").substr(5),b.what="#"+b.type+"-",a("#the-list").on("click","a.editinline",function(){return inlineEditTax.edit(this),!1}),c.keyup(function(a){if(27===a.which)return inlineEditTax.revert()}),a(".cancel",c).click(function(){return inlineEditTax.revert()}),a(".save",c).click(function(){return inlineEditTax.save(this)}),a("input, select",c).keydown(function(a){if(13===a.which)return inlineEditTax.save(this)}),a('#posts-filter input[type="submit"]').mousedown(function(){b.revert()})},toggle:function(b){var c=this;"none"===a(c.what+c.getId(b)).css("display")?c.revert():c.edit(b)},edit:function(b){var c,d,e,f=this;return f.revert(),"object"==typeof b&&(b=f.getId(b)),c=a("#inline-edit").clone(!0),d=a("#inline_"+b),a("td",c).attr("colspan",a("th:visible, td:visible",".wp-list-table.widefat:first thead").length),a(f.what+b).hide().after(c).after('<tr class="hidden"></tr>'),e=a(".name",d),e.find("img").replaceWith(function(){return this.alt}),e=e.text(),a(':input[name="name"]',c).val(e),e=a(".slug",d),e.find("img").replaceWith(function(){return this.alt}),e=e.text(),a(':input[name="slug"]',c).val(e),a(c).attr("id","edit-"+b).addClass("inline-editor").show(),a(".ptitle",c).eq(0).focus(),!1},save:function(c){var d,e,f=a('input[name="taxonomy"]').val()||"";return"object"==typeof c&&(c=this.getId(c)),a("table.widefat .spinner").addClass("is-active"),d={action:"inline-save-tax",tax_type:this.type,tax_ID:c,taxonomy:f},e=a("#edit-"+c).find(":input").serialize(),d=e+"&"+a.param(d),a.post(ajaxurl,d,function(d){var e,f,g,h=a("#edit-"+c+" .inline-edit-save .notice-error"),i=h.find(".error");a("table.widefat .spinner").removeClass("is-active"),d?-1!==d.indexOf("<tr")?(a(inlineEditTax.what+c).siblings("tr.hidden").addBack().remove(),f=a(d).attr("id"),a("#edit-"+c).before(d).remove(),f?(g=f.replace(inlineEditTax.type+"-",""),e=a("#"+f)):(g=c,e=a(inlineEditTax.what+c)),a("#parent").find("option[value="+g+"]").text(e.find(".row-title").text()),e.hide().fadeIn(400,function(){e.find(".editinline").focus(),b.a11y.speak(inlineEditL10n.saved)})):(h.removeClass("hidden"),i.html(d),b.a11y.speak(i.text())):(h.removeClass("hidden"),i.html(inlineEditL10n.error),b.a11y.speak(inlineEditL10n.error))}),!1},revert:function(){var b=a("table.widefat tr.inline-editor").attr("id");b&&(a("table.widefat .spinner").removeClass("is-active"),a("#"+b).siblings("tr.hidden").addBack().remove(),b=b.substr(b.lastIndexOf("-")+1),a(this.what+b).show().find(".editinline").focus())},getId:function(b){var c="TR"===b.tagName?b.id:a(b).parents("tr").attr("id"),d=c.split("-");return d[d.length-1]}},a(document).ready(function(){inlineEditTax.init()})}(jQuery,window.wp);

View File

@ -424,7 +424,7 @@ function unregister_taxonomy( $taxonomy ) {
// Do not allow unregistering internal taxonomies.
if ( $taxonomy_object->_builtin ) {
return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed' ) );
return new WP_Error( 'invalid_taxonomy', __( 'Unregistering a built-in taxonomy is not allowed.' ) );
}
global $wp_taxonomies;
@ -746,7 +746,7 @@ function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
*/
function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
if ( empty( $term ) ) {
return new WP_Error( 'invalid_term', __( 'Empty Term' ) );
return new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
}
if ( $taxonomy && ! taxonomy_exists( $taxonomy ) ) {
@ -2123,7 +2123,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
$data = apply_filters( 'wp_insert_term_data', $data, $taxonomy, $args );
if ( false === $wpdb->insert( $wpdb->terms, $data ) ) {
return new WP_Error( 'db_insert_error', __( 'Could not insert term into the database' ), $wpdb->last_error );
return new WP_Error( 'db_insert_error', __( 'Could not insert term into the database.' ), $wpdb->last_error );
}
$term_id = (int) $wpdb->insert_id;
@ -2347,7 +2347,7 @@ function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
$values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order);
if ( $values )
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)" ) )
return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error );
return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database.' ), $wpdb->last_error );
}
wp_cache_delete( $object_id, $taxonomy . '_relationships' );
@ -2615,7 +2615,7 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) {
}
if ( ! $term ) {
return new WP_Error( 'invalid_term', __( 'Empty Term' ) );
return new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
}
$term = (array) $term->data;
@ -2701,7 +2701,7 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) {
$slug = wp_unique_term_slug($slug, (object) $args);
} else {
/* translators: 1: Taxonomy term slug */
return new WP_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
return new WP_Error( 'duplicate_term_slug', sprintf( __( 'The slug &#8220;%s&#8221; is already in use by another term.' ), $slug ) );
}
}
@ -3916,7 +3916,7 @@ function get_term_link( $term, $taxonomy = '' ) {
}
if ( !is_object($term) )
$term = new WP_Error('invalid_term', __('Empty Term'));
$term = new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
if ( is_wp_error( $term ) )
return $term;
@ -4128,7 +4128,7 @@ function get_post_taxonomies( $post = 0 ) {
*/
function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
if ( !$object_id = (int) $object_id )
return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );
return new WP_Error( 'invalid_object', __( 'Invalid object ID.' ) );
$object_terms = get_object_term_cache( $object_id, $taxonomy );
if ( false === $object_terms ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41683';
$wp_version = '4.9-alpha-41684';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.