Updates: Standardize JS Custom Event Names

Merges [38218] in to 4.6 branch.

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/branches/4.6@38219


git-svn-id: http://core.svn.wordpress.org/branches/4.6@38160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2016-08-08 22:52:29 +00:00
parent c959c32860
commit dcf9711226
5 changed files with 8 additions and 8 deletions

View File

@ -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 } );
} );

File diff suppressed because one or more lines are too long

View File

@ -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 );
};
/**

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-RC1-38214';
$wp_version = '4.6-RC1-38219';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.