Customize: Fix live preview button in theme details modal so it includes target theme.
Fixes issue introduced in [38813]. Props celloexpressions. See #37661. Fixes #38475. git-svn-id: https://develop.svn.wordpress.org/trunk@38889 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
71cbe11ee3
commit
b5bc4fde53
|
@ -1186,7 +1186,7 @@
|
||||||
|
|
||||||
// Preview installed themes.
|
// Preview installed themes.
|
||||||
section.container.on( 'click', '.theme-actions .preview-theme', function() {
|
section.container.on( 'click', '.theme-actions .preview-theme', function() {
|
||||||
var themeId = $( this ).data( 'themeId' );
|
var themeId = $( this ).data( 'slug' );
|
||||||
|
|
||||||
$( '.wp-full-overlay' ).addClass( 'customize-loading' );
|
$( '.wp-full-overlay' ).addClass( 'customize-loading' );
|
||||||
api.panel( 'themes' ).loadThemePreview( themeId ).fail( function() {
|
api.panel( 'themes' ).loadThemePreview( themeId ).fail( function() {
|
||||||
|
@ -1735,7 +1735,7 @@
|
||||||
* @param {Object} theme
|
* @param {Object} theme
|
||||||
*/
|
*/
|
||||||
showDetails: function ( theme, callback ) {
|
showDetails: function ( theme, callback ) {
|
||||||
var section = this, link;
|
var section = this;
|
||||||
callback = callback || function(){};
|
callback = callback || function(){};
|
||||||
section.currentTheme = theme.id;
|
section.currentTheme = theme.id;
|
||||||
section.overlay.html( section.template( theme ) )
|
section.overlay.html( section.template( theme ) )
|
||||||
|
@ -1745,21 +1745,6 @@
|
||||||
section.containFocus( section.overlay );
|
section.containFocus( section.overlay );
|
||||||
section.updateLimits();
|
section.updateLimits();
|
||||||
wp.a11y.speak( api.settings.l10n.announceThemeDetails.replace( '%s', theme.name ) );
|
wp.a11y.speak( api.settings.l10n.announceThemeDetails.replace( '%s', theme.name ) );
|
||||||
|
|
||||||
link = section.overlay.find( '.inactive-theme > a' );
|
|
||||||
link.on( 'click', function( event ) {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
// Short-circuit if request is currently being made.
|
|
||||||
if ( link.hasClass( 'disabled' ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
link.addClass( 'disabled' );
|
|
||||||
|
|
||||||
api.panel( 'themes' ).loadThemePreview( theme.id ).fail( function() {
|
|
||||||
link.removeClass( 'disabled' );
|
|
||||||
} );
|
|
||||||
} );
|
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -106,13 +106,13 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
|
||||||
<# } else if ( 'installed' === data.theme.type ) { #>
|
<# } else if ( 'installed' === data.theme.type ) { #>
|
||||||
<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
|
<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
|
||||||
<div class="theme-actions">
|
<div class="theme-actions">
|
||||||
<button type="button" class="button button-primary preview-theme" aria-label="<?php echo esc_attr( $preview_label ); ?>" data-theme-id="{{ data.theme.id }}"><?php _e( 'Live Preview' ); ?></span>
|
<button type="button" class="button button-primary preview-theme" aria-label="<?php echo esc_attr( $preview_label ); ?>" data-slug="{{ data.theme.id }}"><?php _e( 'Live Preview' ); ?></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="notice notice-success notice-alt"><p><?php _e( 'Installed' ); ?></p></div>
|
<div class="notice notice-success notice-alt"><p><?php _e( 'Installed' ); ?></p></div>
|
||||||
<# } else { #>
|
<# } else { #>
|
||||||
<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
|
<h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
|
||||||
<div class="theme-actions">
|
<div class="theme-actions">
|
||||||
<button type="button" class="button button-primary theme-install preview" aria-label="<?php echo esc_attr( $install_label ); ?>" data-slug="{{ data.theme.id }}" data-name="{{ data.theme.name }}" data-theme-id="{{ data.theme.id }}"><?php _e( 'Install & Preview' ); ?></button>
|
<button type="button" class="button button-primary theme-install preview" aria-label="<?php echo esc_attr( $install_label ); ?>" data-slug="{{ data.theme.id }}" data-name="{{ data.theme.name }}"><?php _e( 'Install & Preview' ); ?></button>
|
||||||
</div>
|
</div>
|
||||||
<# } #>
|
<# } #>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue