Make WordPress Core

Changeset 31954


Ignore:
Timestamp:
04/01/2015 12:35:26 PM (10 years ago)
Author:
ocean90
Message:

Customizer Theme Switcher: Switch the details/live preview buttons.

props celloexpressions, ocean90.
fixes #31791.

Location:
trunk/src
Files:
4 edited

Legend:

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

    r31918 r31954  
    907907}
    908908
    909 .wp-customizer .theme-browser .theme.active .theme-name {
    910     padding-right: 15px;
    911 }
    912 
    913909.wp-customizer #themes-filter {
    914910    font-size: 16px;
     
    916912    line-height: 1.5;
    917913    width: 100%;
     914}
     915
     916
     917.wp-customizer .theme-browser .theme.active:hover,
     918.wp-customizer .theme-browser .theme.active:focus {
     919    cursor: default;
     920}
     921
     922.wp-customizer .theme-browser .theme.active .more-details {
     923    display: none;
     924}
     925
     926.wp-customizer .theme-browser .theme.active .theme-name {
     927    padding-right: 15px;
     928}
     929
     930.wp-customizer .theme-browser.rendered .theme.active:hover .theme-screenshot img,
     931.wp-customizer .theme-browser.rendered .theme.active:focus .theme-screenshot img {
     932    opacity: 1;
    918933}
    919934
  • trunk/src/wp-admin/includes/theme.php

    r31943 r31954  
    548548            </div>
    549549
    550             <div class="theme-actions">
    551                 <# if ( ! data.active ) { #>
     550            <# if ( ! data.active ) { #>
     551                <div class="theme-actions">
    552552                    <div class="inactive-theme">
    553553                        <a href="<?php echo add_query_arg( 'theme', '{{ data.id }}' ); ?>" target="_top" class="button button-primary"><?php _e( 'Live Preview' ); ?></a>
    554554                    </div>
    555                 <# } #>
    556             </div>
     555                </div>
     556            <# } #>
    557557        </div>
    558558    </script>
  • trunk/src/wp-admin/js/customize-controls.js

    r31944 r31954  
    647647
    648648                section.closeDetails();
    649             });
    650 
    651             section.container.on( 'click keydown', '.theme-actions .button', function( event ) {
    652                 if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
    653                     return;
    654                 }
    655 
    656                 $( '.wp-full-overlay' ).addClass( 'customize-loading' );
    657649            });
    658650
     
    19081900                }
    19091901
    1910                 api.section( control.section() ).showDetails( control.params.theme );
    1911             });
    1912 
    1913             control.container.on( 'click keydown', '.theme-actions .button', function( event ) {
     1902                if ( $( this ).hasClass( 'active' ) ) {
     1903                    return;
     1904                }
     1905
     1906                var previewUrl = $( this ).data( 'previewUrl' );
     1907
     1908                $( '.wp-full-overlay' ).addClass( 'customize-loading' );
     1909
     1910                window.parent.location = previewUrl;
     1911            });
     1912
     1913            control.container.on( 'click keydown', '.theme-actions .theme-details', function( event ) {
    19141914                if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
    19151915                    return;
    19161916                }
    19171917
    1918                 $( '.wp-full-overlay' ).addClass( 'customize-loading' );
     1918                event.preventDefault(); // Keep this AFTER the key filter above
     1919
     1920                api.section( control.section() ).showDetails( control.params.theme );
    19191921            });
    19201922        },
  • trunk/src/wp-includes/class-wp-customize-control.php

    r31950 r31954  
    12011201     */
    12021202    public function content_template() {
    1203     ?>
    1204         <div class="theme<# if ( data.theme.active ) { #> active<# } #>" tabindex="0" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name">
     1203        $preview_url = site_url( add_query_arg( 'theme', '{{ data.theme.id }}' ) );
     1204        ?>
     1205        <div class="theme<# if ( data.theme.active ) { #> active<# } #>"<# if ( ! data.theme.active ) { #> tabindex="0"<# } #> data-preview-url="<?php echo esc_attr( $preview_url ); ?>" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name">
    12051206            <# if ( data.theme.screenshot[0] ) { #>
    12061207                <div class="theme-screenshot">
     
    12101211                <div class="theme-screenshot blank"></div>
    12111212            <# } #>
    1212             <span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Theme Details' ); ?></span>
     1213            <span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Live Preview' ); ?></span>
    12131214            <div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.theme.author }}' ); ?></div>
    12141215
     
    12261227            <# if ( ! data.theme.active ) { #>
    12271228                <div class="theme-actions">
    1228                     <a class="button" href="<?php echo add_query_arg( 'theme', '{{ data.theme.id }}' ); ?>" target="_top"><?php _e( 'Live Preview' ); ?></a>
     1229                    <button type="button" class="button theme-details"><?php _e( 'Theme Details' ); ?></button>
    12291230                </div>
    12301231            <# } #>
Note: See TracChangeset for help on using the changeset viewer.