mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Updates: Standardize JS Custom Event Names
Custom JS events are triggered on the document in order for plugins to have something to hook into. The standard began in #31819 is dash separated and begins with `wp` to signify the namespace, followed by the subject of our action ( "theme", "plugin", etc.) followed by the action and an optional indicator of status ( "install-success", "deleting" ). This brings some of the theme hooks in line with the standard. As of now, all plugin actions in `src/wp-admin/js/updates.js` have an equal corresponding theme action. Fixes #37598. See #37512, #37216, #31819. Props olarmarius, ocean90. Built from https://develop.svn.wordpress.org/trunk@38218 git-svn-id: http://core.svn.wordpress.org/trunk@38159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b45adc74df
commit
b86f7a832b
@ -597,7 +597,7 @@ themes.view.Theme = wp.Backbone.View.extend({
|
||||
|
||||
wp.updates.maybeRequestFilesystemCredentials( event );
|
||||
|
||||
$( document ).on( 'wp-install-theme-success', function( event, response ) {
|
||||
$( document ).on( 'wp-theme-install-success', function( event, response ) {
|
||||
if ( _this.model.get( 'id' ) === response.slug ) {
|
||||
_this.model.set( { 'installed': true } );
|
||||
}
|
||||
@ -799,7 +799,7 @@ themes.view.Details = wp.Backbone.View.extend({
|
||||
|
||||
wp.updates.maybeRequestFilesystemCredentials( event );
|
||||
|
||||
$( document ).one( 'wp-delete-theme-success', function( event, response ) {
|
||||
$( document ).one( 'wp-theme-delete-success', function( event, response ) {
|
||||
_this.$el.find( '.close' ).trigger( 'click' );
|
||||
$( '[data-slug="' + response.slug + '"' ).css( { backgroundColor:'#faafaa' } ).fadeOut( 350, function() {
|
||||
$( this ).remove();
|
||||
@ -972,7 +972,7 @@ themes.view.Preview = themes.view.Details.extend({
|
||||
|
||||
wp.updates.maybeRequestFilesystemCredentials( event );
|
||||
|
||||
$( document ).on( 'wp-install-theme-success', function() {
|
||||
$( document ).on( 'wp-theme-install-success', function() {
|
||||
_this.model.set( { 'installed': true } );
|
||||
} );
|
||||
|
||||
|
2
wp-admin/js/theme.min.js
vendored
2
wp-admin/js/theme.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1071,7 +1071,7 @@
|
||||
var $card = $( '.wp-full-overlay-header, [data-slug=' + response.slug + ']' ),
|
||||
$message;
|
||||
|
||||
$document.trigger( 'wp-install-theme-success', response );
|
||||
$document.trigger( 'wp-theme-install-success', response );
|
||||
|
||||
$message = $card.find( '.button-primary' )
|
||||
.removeClass( 'updating-message' )
|
||||
@ -1243,7 +1243,7 @@
|
||||
|
||||
wp.a11y.speak( wp.updates.l10n.deleted, 'polite' );
|
||||
|
||||
$document.trigger( 'wp-delete-theme-success', response );
|
||||
$document.trigger( 'wp-theme-delete-success', response );
|
||||
};
|
||||
|
||||
/**
|
||||
|
2
wp-admin/js/updates.min.js
vendored
2
wp-admin/js/updates.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-alpha-38217';
|
||||
$wp_version = '4.7-alpha-38218';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user