Ticket #31770: 31770.2.diff
| File 31770.2.diff, 2.5 KB (added by , 11 years ago) |
|---|
-
src/wp-admin/js/updates.js
191 191 }; 192 192 193 193 /** 194 * Add an admin notice on plugin install success or failure. 195 * 196 * @since 4.2.0 197 * 198 * @param {string} plugin The plugin name or slug 199 * @param {string} className Class of the notice to add, either updated or error. 200 * 201 */ 202 wp.updates.addAdminNotice = function( plugin, className ) { 203 /** 204 * Add a success admin notice at the top of the page. 205 */ 206 var $messageorigin = $( '.plugin-notice.' + className ).first(), 207 message = $messageorigin.clone().insertAfter( $messageorigin ), 208 $message = $( message ), 209 $messageP = $message.find( 'p' ), 210 capitalizedSlug = plugin.charAt( 0 ).toUpperCase() + plugin.slice( 1 ); 211 newtext = capitalizedSlug + $messageP.text(); 212 213 $message.removeClass( 'hidden' ); 214 $messageP.text( newtext ); 215 216 }; 217 218 /** 194 219 * On a successful plugin update, update the UI with the result. 195 220 * 196 221 * @since 4.2.0 … … 204 229 $updateMessage = $pluginRow.next().find( '.update-message' ); 205 230 $pluginRow.addClass( 'updated' ).removeClass( 'update' ); 206 231 232 wp.updates.addAdminNotice( response.slug, 'updated' ); 233 207 234 // Update the version number in the row. 208 235 var newText = $pluginRow.find('.plugin-version-author-uri').html().replace( response.oldVersion, response.newVersion ); 209 236 $pluginRow.find('.plugin-version-author-uri').html( newText ); … … 248 275 } 249 276 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 250 277 $message = $( '[data-slug="' + response.slug + '"]' ).next().find( '.update-message' ); 278 wp.updates.addAdminNotice( response.slug, 'error' ); 279 251 280 } else if ( 'plugin-install' === pagenow ) { 252 281 $message = $( '.plugin-card-' + response.slug ).find( '.update-now' ); 253 282 } -
src/wp-admin/plugins.php
450 450 if ( $s ) 451 451 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $s ) ); ?> 452 452 </h2> 453 453 <div class="plugin-notice updated hidden"><p><?php _e( ' updated successfully.' ); ?></p></div> 454 <div class="plugin-notice error hidden"><p><?php _e( ' update failed.' ); ?></p></div> 454 455 <?php 455 456 /** 456 457 * Fires before the plugins list table is rendered.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)