Ticket #31770: 31770.diff
| File 31770.diff, 2.6 KB (added by , 11 years ago) |
|---|
-
src/wp-admin/js/updates.js
178 178 }; 179 179 180 180 /** 181 * Add an admin notice on plugin install success or failure. 182 * 183 * @since 4.2.0 184 * 185 * @param {string} plugin The plugin name or slug 186 * @param {string} className Class of the notice to add, either updated or error. 187 * 188 */ 189 wp.updates.addAdminNotice = function( plugin, className ) { 190 /** 191 * Add a success admin notice at the top of the page. 192 */ 193 var $messageorigin = $( '.plugin-notice.' + className ).first(), 194 message = $messageorigin.clone().insertAfter( $messageorigin ), 195 $message = $( message ), 196 $messageP = $message.find( 'p' ), 197 capitalizedSlug = plugin.charAt( 0 ).toUpperCase() + plugin.slice( 1 ); 198 newtext = capitalizedSlug + $messageP.text(); 199 200 $message.removeClass( 'hidden' ); 201 $messageP.text( newtext ); 202 203 /** 204 * Scroll to the top so the user can see the notice. 205 */ 206 $( window ).scrollTop( 0 ); 207 }; 208 209 /** 181 210 * On a successful plugin update, update the UI with the result. 182 211 * 183 212 * @since 4.2.0 … … 191 220 $updateMessage = $pluginRow.next().find( '.update-message' ); 192 221 $pluginRow.addClass( 'updated' ).removeClass( 'update' ); 193 222 223 wp.updates.addAdminNotice( response.slug, 'updated' ); 224 194 225 // Update the version number in the row. 195 226 var newText = $pluginRow.find('.plugin-version-author-uri').html().replace( response.oldVersion, response.newVersion ); 196 227 $pluginRow.find('.plugin-version-author-uri').html( newText ); … … 231 262 } 232 263 if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) { 233 264 $message = $( '[data-slug="' + response.slug + '"]' ).next().find( '.update-message' ); 265 wp.updates.addAdminNotice( response.slug, 'error' ); 266 234 267 } else if ( 'plugin-install' === pagenow ) { 235 268 $message = $( '.plugin-card-' + response.slug ).find( '.update-now' ); 236 269 } -
src/wp-admin/plugins.php
442 442 if ( $s ) 443 443 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $s ) ); ?> 444 444 </h2> 445 445 <div class="plugin-notice updated hidden"><p><?php _e( ' updated successfully.' ); ?></p></div> 446 <div class="plugin-notice error hidden"><p><?php _e( ' update failed.' ); ?></p></div> 446 447 <?php 447 448 /** 448 449 * Fires before the plugins list table is rendered.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)