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

props celloexpressions, ocean90.
fixes #31791.
Built from https://develop.svn.wordpress.org/trunk@31954


git-svn-id: http://core.svn.wordpress.org/trunk@31933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-04-01 12:36:26 +00:00
parent a3bbadbbea
commit 8ab7c076d6
9 changed files with 65 additions and 32 deletions

View File

@ -906,10 +906,6 @@ p.customize-section-description {
font-size: 32px; font-size: 32px;
} }
.wp-customizer .theme-browser .theme.active .theme-name {
padding-left: 15px;
}
.wp-customizer #themes-filter { .wp-customizer #themes-filter {
font-size: 16px; font-size: 16px;
font-weight: 300; font-weight: 300;
@ -917,6 +913,25 @@ p.customize-section-description {
width: 100%; width: 100%;
} }
.wp-customizer .theme-browser .theme.active:hover,
.wp-customizer .theme-browser .theme.active:focus {
cursor: default;
}
.wp-customizer .theme-browser .theme.active .more-details {
display: none;
}
.wp-customizer .theme-browser .theme.active .theme-name {
padding-left: 15px;
}
.wp-customizer .theme-browser.rendered .theme.active:hover .theme-screenshot img,
.wp-customizer .theme-browser.rendered .theme.active:focus .theme-screenshot img {
opacity: 1;
}
/* Panel-like behavior */ /* Panel-like behavior */
#accordion-section-themes .accordion-section-title:after { #accordion-section-themes .accordion-section-title:after {
content: "\f148"; content: "\f148";

File diff suppressed because one or more lines are too long

View File

@ -906,10 +906,6 @@ p.customize-section-description {
font-size: 32px; font-size: 32px;
} }
.wp-customizer .theme-browser .theme.active .theme-name {
padding-right: 15px;
}
.wp-customizer #themes-filter { .wp-customizer #themes-filter {
font-size: 16px; font-size: 16px;
font-weight: 300; font-weight: 300;
@ -917,6 +913,25 @@ p.customize-section-description {
width: 100%; width: 100%;
} }
.wp-customizer .theme-browser .theme.active:hover,
.wp-customizer .theme-browser .theme.active:focus {
cursor: default;
}
.wp-customizer .theme-browser .theme.active .more-details {
display: none;
}
.wp-customizer .theme-browser .theme.active .theme-name {
padding-right: 15px;
}
.wp-customizer .theme-browser.rendered .theme.active:hover .theme-screenshot img,
.wp-customizer .theme-browser.rendered .theme.active:focus .theme-screenshot img {
opacity: 1;
}
/* Panel-like behavior */ /* Panel-like behavior */
#accordion-section-themes .accordion-section-title:after { #accordion-section-themes .accordion-section-title:after {
content: "\f148"; content: "\f148";

File diff suppressed because one or more lines are too long

View File

@ -547,13 +547,13 @@ function customize_themes_print_templates() {
</div> </div>
</div> </div>
<div class="theme-actions"> <# if ( ! data.active ) { #>
<# if ( ! data.active ) { #> <div class="theme-actions">
<div class="inactive-theme"> <div class="inactive-theme">
<a href="<?php echo add_query_arg( 'theme', '{{ data.id }}' ); ?>" target="_top" class="button button-primary"><?php _e( 'Live Preview' ); ?></a> <a href="<?php echo add_query_arg( 'theme', '{{ data.id }}' ); ?>" target="_top" class="button button-primary"><?php _e( 'Live Preview' ); ?></a>
</div> </div>
<# } #> </div>
</div> <# } #>
</div> </div>
</script> </script>
<?php <?php

View File

@ -648,14 +648,6 @@
section.closeDetails(); section.closeDetails();
}); });
section.container.on( 'click keydown', '.theme-actions .button', function( event ) {
if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
return;
}
$( '.wp-full-overlay' ).addClass( 'customize-loading' );
});
section.container.on( 'input', '#themes-filter', function( event ) { section.container.on( 'input', '#themes-filter', function( event ) {
var count, var count,
term = event.currentTarget.value.toLowerCase().trim().replace( '-', ' ' ), term = event.currentTarget.value.toLowerCase().trim().replace( '-', ' ' ),
@ -1907,15 +1899,25 @@
return; return;
} }
api.section( control.section() ).showDetails( control.params.theme ); if ( $( this ).hasClass( 'active' ) ) {
return;
}
var previewUrl = $( this ).data( 'previewUrl' );
$( '.wp-full-overlay' ).addClass( 'customize-loading' );
window.parent.location = previewUrl;
}); });
control.container.on( 'click keydown', '.theme-actions .button', function( event ) { control.container.on( 'click keydown', '.theme-actions .theme-details', function( event ) {
if ( api.utils.isKeydownButNotEnterEvent( event ) ) { if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
return; return;
} }
$( '.wp-full-overlay' ).addClass( 'customize-loading' ); event.preventDefault(); // Keep this AFTER the key filter above
api.section( control.section() ).showDetails( control.params.theme );
}); });
}, },

File diff suppressed because one or more lines are too long

View File

@ -1200,8 +1200,9 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
* @since 4.2.0 * @since 4.2.0
*/ */
public function content_template() { public function content_template() {
?> $preview_url = site_url( add_query_arg( 'theme', '{{ data.theme.id }}' ) );
<div class="theme<# if ( data.theme.active ) { #> active<# } #>" tabindex="0" aria-describedby="{{ data.theme.id }}-action {{ data.theme.id }}-name"> ?>
<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">
<# if ( data.theme.screenshot[0] ) { #> <# if ( data.theme.screenshot[0] ) { #>
<div class="theme-screenshot"> <div class="theme-screenshot">
<img src="{{ data.theme.screenshot[0] }}" alt="" /> <img src="{{ data.theme.screenshot[0] }}" alt="" />
@ -1209,7 +1210,7 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
<# } else { #> <# } else { #>
<div class="theme-screenshot blank"></div> <div class="theme-screenshot blank"></div>
<# } #> <# } #>
<span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Theme Details' ); ?></span> <span class="more-details" id="{{ data.theme.id }}-action"><?php _e( 'Live Preview' ); ?></span>
<div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.theme.author }}' ); ?></div> <div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.theme.author }}' ); ?></div>
<# if ( data.theme.active ) { #> <# if ( data.theme.active ) { #>
@ -1225,7 +1226,7 @@ class WP_Customize_Theme_Control extends WP_Customize_Control {
<# if ( ! data.theme.active ) { #> <# if ( ! data.theme.active ) { #>
<div class="theme-actions"> <div class="theme-actions">
<a class="button" href="<?php echo add_query_arg( 'theme', '{{ data.theme.id }}' ); ?>" target="_top"><?php _e( 'Live Preview' ); ?></a> <button type="button" class="button theme-details"><?php _e( 'Theme Details' ); ?></button>
</div> </div>
<# } #> <# } #>
</div> </div>

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.2-beta3-31953'; $wp_version = '4.2-beta3-31954';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.