Customizer: Collapse any expanded panel/sections before expanding other panel/sections

Fix removes need for workaround introduced in [33488] for direct link from nav menu widget to the customizer widgets panel. The todo is now implemented.

Props celloexpressions, westonruter.
Fixes #33396 for trunk.

Built from https://develop.svn.wordpress.org/trunk@33837


git-svn-id: http://core.svn.wordpress.org/trunk@33805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-08-31 23:08:42 +00:00
parent e3f3f470ea
commit 1413f2edd5
4 changed files with 8 additions and 6 deletions

View File

@ -655,6 +655,9 @@
completeCallback: expand completeCallback: expand
}); });
} else { } else {
api.panel.each( function( panel ) {
panel.collapse();
});
expand(); expand();
} }
@ -1264,7 +1267,7 @@
// Collapse any sibling sections/panels // Collapse any sibling sections/panels
api.section.each( function ( section ) { api.section.each( function ( section ) {
if ( ! section.panel() ) { if ( panel.id !== section.panel() ) {
section.collapse( { duration: 0 } ); section.collapse( { duration: 0 } );
} }
}); });

File diff suppressed because one or more lines are too long

View File

@ -1570,8 +1570,7 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
<p class="nav-menu-widget-no-menus-message" <?php if ( ! empty( $menus ) ) { echo ' style="display:none" '; } ?>> <p class="nav-menu-widget-no-menus-message" <?php if ( ! empty( $menus ) ) { echo ' style="display:none" '; } ?>>
<?php <?php
if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) { if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) {
// @todo When expanding a panel, the JS should be smart enough to collapse any existing panels and sections. $url = 'javascript: wp.customize.panel( "nav_menus" ).focus();';
$url = 'javascript: wp.customize.section.each(function( section ){ section.collapse(); }); wp.customize.panel( "nav_menus" ).focus();';
} else { } else {
$url = admin_url( 'nav-menus.php' ); $url = admin_url( 'nav-menus.php' );
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-33836'; $wp_version = '4.4-alpha-33837';
/** /**
* 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.