Make WordPress Core

Changeset 38889


Ignore:
Timestamp:
10/24/2016 07:14:26 PM (8 years ago)
Author:
westonruter
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/customize-controls.js

    r38853 r38889  
    11871187            // Preview installed themes.
    11881188            section.container.on( 'click', '.theme-actions .preview-theme', function() {
    1189                 var themeId = $( this ).data( 'themeId' );
     1189                var themeId = $( this ).data( 'slug' );
    11901190
    11911191                $( '.wp-full-overlay' ).addClass( 'customize-loading' );
     
    17361736         */
    17371737        showDetails: function ( theme, callback ) {
    1738             var section = this, link;
     1738            var section = this;
    17391739            callback = callback || function(){};
    17401740            section.currentTheme = theme.id;
     
    17461746            section.updateLimits();
    17471747            wp.a11y.speak( api.settings.l10n.announceThemeDetails.replace( '%s', theme.name ) );
    1748 
    1749             link = section.overlay.find( '.inactive-theme > a' );
    1750             link.on( 'click', function( event ) {
    1751                 event.preventDefault();
    1752 
    1753                 // Short-circuit if request is currently being made.
    1754                 if ( link.hasClass( 'disabled' ) ) {
    1755                     return;
    1756                 }
    1757                 link.addClass( 'disabled' );
    1758 
    1759                 api.panel( 'themes' ).loadThemePreview( theme.id ).fail( function() {
    1760                     link.removeClass( 'disabled' );
    1761                 } );
    1762             } );
    17631748            callback();
    17641749        },
  • trunk/src/wp-includes/customize/class-wp-customize-theme-control.php

    r38813 r38889  
    107107                <h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
    108108                <div class="theme-actions">
    109                     <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>
     109                    <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>
    110110                </div>
    111111                <div class="notice notice-success notice-alt"><p><?php _e( 'Installed' ); ?></p></div>
     
    113113                <h3 class="theme-name" id="{{ data.section }}-{{ data.theme.id }}-name">{{ data.theme.name }}</h3>
    114114                <div class="theme-actions">
    115                     <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>
     115                    <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>
    116116                </div>
    117117            <# } #>
Note: See TracChangeset for help on using the changeset viewer.