Theme Customizer: Don't expand theme title if there are no details to show. props nacin, fixes #20757, see #19910.
git-svn-id: http://core.svn.wordpress.org/trunk@20940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cc8f2c1e2d
commit
c2c3f2ba7f
|
@ -60,14 +60,20 @@ do_action( 'customize_controls_print_scripts' );
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$screenshot = $wp_customize->theme()->get_screenshot();
|
||||||
|
$cannot_expand = ! ( $screenshot || $wp_customize->theme()->get('Description') );
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="wp-full-overlay-sidebar-content">
|
<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">
|
<div class="customize-section-title">
|
||||||
<span class="preview-notice"><?php _e('You are previewing'); ?></span>
|
<span class="preview-notice"><?php _e('You are previewing'); ?></span>
|
||||||
<strong class="theme-name"><?php echo $wp_customize->theme()->display('Name'); ?></strong>
|
<strong class="theme-name"><?php echo $wp_customize->theme()->display('Name'); ?></strong>
|
||||||
</div>
|
</div>
|
||||||
|
<?php if ( ! $cannot_expand ) : ?>
|
||||||
<div class="customize-section-content">
|
<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 ); ?>" />
|
<img class="theme-screenshot" src="<?php echo esc_url( $screenshot ); ?>" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
@ -75,6 +81,7 @@ do_action( 'customize_controls_print_scripts' );
|
||||||
<div class="theme-description"><?php echo $wp_customize->theme()->display('Description'); ?></div>
|
<div class="theme-description"><?php echo $wp_customize->theme()->display('Description'); ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="customize-theme-controls"><ul>
|
<div id="customize-theme-controls"><ul>
|
||||||
|
|
|
@ -28,6 +28,10 @@ body {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cannot-expand .customize-section-title {
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.customize-section-content {
|
.customize-section-content {
|
||||||
display: none;
|
display: none;
|
||||||
padding: 10px 20px 15px;
|
padding: 10px 20px 15px;
|
||||||
|
@ -84,6 +88,10 @@ body {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cannot-expand .customize-section-title:after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.customize-section.open .customize-section-title:after {
|
.customize-section.open .customize-section-title:after {
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
border-width: 0 6px 6px;
|
border-width: 0 6px 6px;
|
||||||
|
|
|
@ -594,11 +594,15 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// Temporary accordion code.
|
// Temporary accordion code.
|
||||||
$('.customize-section-title').click( function() {
|
$('.customize-section-title').click( function( event ) {
|
||||||
var clicked = $( this ).parents( '.customize-section' );
|
var clicked = $( this ).parents( '.customize-section' );
|
||||||
|
|
||||||
|
if ( clicked.hasClass('cannot-expand') )
|
||||||
|
return;
|
||||||
|
|
||||||
$( '.customize-section' ).not( clicked ).removeClass( 'open' );
|
$( '.customize-section' ).not( clicked ).removeClass( 'open' );
|
||||||
clicked.toggleClass( 'open' );
|
clicked.toggleClass( 'open' );
|
||||||
return false;
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Button bindings.
|
// Button bindings.
|
||||||
|
|
Loading…
Reference in New Issue