Changeset 35681
- Timestamp:
- 11/18/2015 08:09:21 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/list-tables.css
r35566 r35681 1579 1579 } 1580 1580 1581 .plugin-card-update-failed .update-now { 1582 font-weight: 600; 1583 } 1584 1585 .plugin-card-update-failed .notice-error { 1586 margin: 0; 1587 padding-left: 16px; 1588 -webkit-box-shadow: 0 -1px 0 #dedede; 1589 box-shadow: 0 -1px 0 #dedede; 1590 } 1591 1592 .plugin-card-update-failed .plugin-card-bottom { 1593 display: none; 1594 } 1595 1581 1596 .plugin-card .column-rating { 1582 1597 line-height: 23px; -
trunk/src/wp-admin/js/common.js
r35516 r35681 401 401 402 402 // Make notices dismissible 403 $( '.notice.is-dismissible' ).each( function() { 404 var $this = $( this ), 405 $button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ), 406 btnText = commonL10n.dismiss || ''; 407 408 // Ensure plain text 409 $button.find( '.screen-reader-text' ).text( btnText ); 410 411 $this.append( $button ); 412 413 $button.on( 'click.wp-dismiss-notice', function( event ) { 414 event.preventDefault(); 415 $this.fadeTo( 100 , 0, function() { 416 $(this).slideUp( 100, function() { 417 $(this).remove(); 403 function makeNoticesDismissible() { 404 $( '.notice.is-dismissible' ).each( function() { 405 var $el = $( this ), 406 $button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ), 407 btnText = commonL10n.dismiss || ''; 408 409 // Ensure plain text 410 $button.find( '.screen-reader-text' ).text( btnText ); 411 $button.on( 'click.wp-dismiss-notice', function( event ) { 412 event.preventDefault(); 413 $el.fadeTo( 100, 0, function() { 414 $el.slideUp( 100, function() { 415 $el.remove(); 416 }); 418 417 }); 419 418 }); 420 }); 419 420 $el.append( $button ); 421 }); 422 } 423 424 $document.on( 'wp-plugin-update-error', function() { 425 makeNoticesDismissible(); 421 426 }); 422 427 … … 896 901 setPinMenu(); 897 902 currentMenuItemHasPopup(); 903 makeNoticesDismissible(); 898 904 899 905 $document.on( 'wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu ); -
trunk/src/wp-admin/js/updates.js
r35155 r35681 147 147 */ 148 148 wp.updates.updatePlugin = function( plugin, slug ) { 149 var $message, name; 149 var $message, name, 150 $card = $( '.plugin-card-' + slug ); 151 150 152 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 151 153 $message = $( '[data-slug="' + slug + '"]' ).next().find( '.update-message' ); 152 154 } else if ( 'plugin-install' === pagenow ) { 153 $message = $ ( '.plugin-card-' + slug ).find( '.update-now' );155 $message = $card.find( '.update-now' ); 154 156 name = $message.data( 'name' ); 155 157 $message.attr( 'aria-label', wp.updates.l10n.updatingLabel.replace( '%s', name ) ); 158 // Remove previous error messages, if any. 159 $card.removeClass( 'plugin-card-update-failed' ).find( '.notice.notice-error' ).remove(); 156 160 } 157 161 … … 249 253 */ 250 254 wp.updates.updateError = function( response ) { 251 var $message, name; 255 var $card = $( '.plugin-card-' + response.slug ), 256 $message, 257 $button, 258 name, 259 error_message; 260 252 261 wp.updates.updateDoneSuccessfully = false; 262 253 263 if ( response.errorCode && response.errorCode == 'unable_to_connect_to_filesystem' && wp.updates.shouldRequestFilesystemCredentials ) { 254 264 wp.updates.credentialError( response, 'update-plugin' ); 255 265 return; 256 266 } 267 268 error_message = wp.updates.l10n.updateFailed.replace( '%s', response.error ); 269 257 270 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 258 271 $message = $( '[data-slug="' + response.slug + '"]' ).next().find( '.update-message' ); 272 $message.html( error_message ).removeClass( 'updating-message' ); 259 273 } else if ( 'plugin-install' === pagenow ) { 260 $message = $( '.plugin-card-' + response.slug ).find( '.update-now' ); 261 262 name = $message.data( 'name' ); 263 $message.attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', name ) ); 264 } 265 $message.removeClass( 'updating-message' ); 266 $message.html( wp.updates.l10n.updateFailed.replace( '%s', response.error ) ); 267 wp.a11y.speak( wp.updates.l10n.updateFailed ); 274 $button = $card.find( '.update-now' ); 275 name = $button.data( 'name' ); 276 277 $card 278 .addClass( 'plugin-card-update-failed' ) 279 .append( '<div class="notice notice-error is-dismissible"><p>' + error_message + '</p></div>' ); 280 281 $button 282 .attr( 'aria-label', wp.updates.l10n.updateFailedLabel.replace( '%s', name ) ) 283 .html( wp.updates.l10n.updateFailedShort ).removeClass( 'updating-message' ); 284 285 $card.on( 'click', '.notice.is-dismissible .notice-dismiss', function() { 286 // Use same delay as the total duration of the notice fadeTo + slideUp animation. 287 setTimeout( function() { 288 $card 289 .removeClass( 'plugin-card-update-failed' ) 290 .find( '.column-name a' ).focus(); 291 }, 200 ); 292 }); 293 } 294 295 wp.a11y.speak( error_message, 'assertive' ); 268 296 269 297 /* -
trunk/src/wp-includes/script-loader.php
r35615 r35681 584 584 'updating' => __( 'Updating...' ), // no ellipsis 585 585 'updated' => __( 'Updated!' ), 586 'updateFailedShort' => __( 'Update Failed!' ), 586 587 /* translators: Error string for a failed update */ 587 588 'updateFailed' => __( 'Update Failed: %s' ),
Note: See TracChangeset
for help on using the changeset viewer.