From b5bc4fde536e2701255f6377a39ad1ac646745d6 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 24 Oct 2016 19:14:26 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/customize-controls.js | 19 ++----------------- .../class-wp-customize-theme-control.php | 4 ++-- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 3508bf5652..24ad043004 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -1186,7 +1186,7 @@ // Preview installed themes. 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' ); api.panel( 'themes' ).loadThemePreview( themeId ).fail( function() { @@ -1735,7 +1735,7 @@ * @param {Object} theme */ showDetails: function ( theme, callback ) { - var section = this, link; + var section = this; callback = callback || function(){}; section.currentTheme = theme.id; section.overlay.html( section.template( theme ) ) @@ -1745,21 +1745,6 @@ section.containFocus( section.overlay ); section.updateLimits(); 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(); }, diff --git a/src/wp-includes/customize/class-wp-customize-theme-control.php b/src/wp-includes/customize/class-wp-customize-theme-control.php index ac2e821010..1401d9fec0 100644 --- a/src/wp-includes/customize/class-wp-customize-theme-control.php +++ b/src/wp-includes/customize/class-wp-customize-theme-control.php @@ -106,13 +106,13 @@ class WP_Customize_Theme_Control extends WP_Customize_Control { <# } else if ( 'installed' === data.theme.type ) { #>

{{ data.theme.name }}

-

<# } else { #>

{{ data.theme.name }}

- +
<# } #>