Ticket #47018: 47018.2.diff
| File 47018.2.diff, 4.4 KB (added by , 4 years ago) |
|---|
-
src/js/_enqueues/admin/tags.js
101 101 $('#submit').on( 'click', function(){ 102 102 var form = $(this).parents('form'); 103 103 104 if ( ! validateForm( form ) )105 return false;106 107 104 if ( addingTerm ) { 108 105 // If we're adding a term, noop the button to avoid duplicate requests. 109 106 return false; … … 127 124 128 125 $('#ajax-response').empty(); 129 126 res = wpAjax.parseAjaxResponse( r, 'ajax-response' ); 130 if ( ! res || res.errors ) 127 128 if ( res.errors && res.responses[0].errors[0].code === 'empty_term_name' ) { 129 validateForm( form ); 130 } 131 132 if ( ! res || res.errors ) { 131 133 return; 134 } 132 135 133 136 parent = form.find( 'select#parent' ).val(); 134 137 -
src/js/_enqueues/lib/ajax-response.js
50 50 parsed.responses.push( response ); 51 51 } ); 52 52 if ( err.length ) { 53 re.html( '<div class=" error">' + err + '</div>' );53 re.html( '<div class="notice notice-error">' + err + '</div>' ); 54 54 wp.a11y.speak( err ); 55 55 } else if ( successmsg.length ) { 56 re.html( '<div class=" updated noticeis-dismissible"><p>' + successmsg + '</p></div>');56 re.html( '<div class="notice notice-success is-dismissible"><p>' + successmsg + '</p></div>'); 57 57 jQuery(document).trigger( 'wp-updates-notice-added' ); 58 58 wp.a11y.speak( successmsg ); 59 59 } 60 60 return parsed; 61 61 } 62 if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); } 63 x = parseInt(x,10); 64 if ( -1 === x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); } 65 else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken + '</p></div>'); } 62 if ( isNaN( x ) ) { 63 wp.a11y.speak( x ); 64 return ! re.html( '<div class="notice notice-error"><p>' + x + '</p></div>' ); 65 } 66 x = parseInt( x, 10 ); 67 if ( -1 === x ) { 68 wp.a11y.speak( wpAjax.noPerm ); 69 return ! re.html( '<div class="notice notice-error"><p>' + wpAjax.noPerm + '</p></div>' ); 70 } 71 else if ( 0 === x ) { 72 wp.a11y.speak( wpAjax.broken ); 73 return ! re.html( '<div class="notice notice-error"><p>' + wpAjax.broken + '</p></div>' ); 74 } 66 75 return true; 67 76 }, 68 77 invalidateForm: function ( selector ) { -
src/wp-admin/css/forms.css
245 245 .form-invalid.form-required select, 246 246 .form-invalid.form-required select:focus { 247 247 border-color: #d63638 !important; 248 box-shadow: 0 0 2px rgba(214, 54, 56, 0.8);248 box-shadow: 0 0 0 1px #d63638; 249 249 } 250 250 251 251 .form-table .form-required.form-invalid td:after { -
src/wp-admin/includes/ajax-actions.php
1071 1071 } 1072 1072 1073 1073 if ( ! $tag || is_wp_error( $tag ) ) { 1074 $message = __( 'An error has occurred. Please reload the page and try again.' ); 1074 $message = __( 'An error has occurred. Please reload the page and try again.' ); 1075 $error_code = 'error'; 1075 1076 1076 1077 if ( is_wp_error( $tag ) && $tag->get_error_message() ) { 1077 1078 $message = $tag->get_error_message(); 1078 1079 } 1079 1080 1081 if ( is_wp_error( $tag ) && $tag->get_error_code() ) { 1082 $error_code = $tag->get_error_code(); 1083 } 1084 1080 1085 $x->add( 1081 1086 array( 1082 1087 'what' => 'taxonomy', 1083 'data' => new WP_Error( 'error', $message ),1088 'data' => new WP_Error( $error_code, $message ), 1084 1089 ) 1085 1090 ); 1086 1091 $x->send(); -
src/wp-includes/script-loader.php
694 694 695 695 $scripts->add( 'clipboard', "/wp-includes/js/clipboard$suffix.js", array(), false, 1 ); 696 696 697 $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array( 'jquery' ), false, 1 );697 $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 ); 698 698 did_action( 'init' ) && $scripts->localize( 699 699 'wp-ajax-response', 700 700 'wpAjax',