Theme Customizer: Don't expand theme title if there are no details to show. props nacin, fixes #20757, see #19910.

git-svn-id: https://develop.svn.wordpress.org/trunk@20940 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2012-05-26 20:47:55 +00:00
parent 04bf106bc6
commit d0a638e2cb
3 changed files with 23 additions and 4 deletions

View File

@ -60,14 +60,20 @@ do_action( 'customize_controls_print_scripts' );
</a>
</div>
<?php
$screenshot = $wp_customize->theme()->get_screenshot();
$cannot_expand = ! ( $screenshot || $wp_customize->theme()->get('Description') );
?>
<div class="wp-full-overlay-sidebar-content">
<div id="customize-info" class="customize-section">
<div id="customize-info" class="customize-section<?php if ( $cannot_expand ) echo ' cannot-expand'; ?>">
<div class="customize-section-title">
<span class="preview-notice"><?php _e('You are previewing'); ?></span>
<strong class="theme-name"><?php echo $wp_customize->theme()->display('Name'); ?></strong>
</div>
<?php if ( ! $cannot_expand ) : ?>
<div class="customize-section-content">
<?php if ( $screenshot = $wp_customize->theme()->get_screenshot() ) : ?>
<?php if ( $screenshot ) : ?>
<img class="theme-screenshot" src="<?php echo esc_url( $screenshot ); ?>" />
<?php endif; ?>
@ -75,6 +81,7 @@ do_action( 'customize_controls_print_scripts' );
<div class="theme-description"><?php echo $wp_customize->theme()->display('Description'); ?></div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<div id="customize-theme-controls"><ul>

View File

@ -28,6 +28,10 @@ body {
user-select: none;
}
.cannot-expand .customize-section-title {
cursor: auto;
}
.customize-section-content {
display: none;
padding: 10px 20px 15px;
@ -84,6 +88,10 @@ body {
z-index: 1;
}
.cannot-expand .customize-section-title:after {
display: none;
}
.customize-section.open .customize-section-title:after {
margin-top: -1px;
border-width: 0 6px 6px;

View File

@ -594,11 +594,15 @@
});
// Temporary accordion code.
$('.customize-section-title').click( function() {
$('.customize-section-title').click( function( event ) {
var clicked = $( this ).parents( '.customize-section' );
if ( clicked.hasClass('cannot-expand') )
return;
$( '.customize-section' ).not( clicked ).removeClass( 'open' );
clicked.toggleClass( 'open' );
return false;
event.preventDefault();
});
// Button bindings.