Customizer: Improve [31252] to show the move-widget buttons only if there is more than one *rendered* sidebar.
fixes #30690. Built from https://develop.svn.wordpress.org/trunk@31419 git-svn-id: http://core.svn.wordpress.org/trunk@31400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
44ac816aed
commit
6adb5c0618
|
@ -621,7 +621,8 @@
|
|||
* Update available sidebars when their rendered state changes
|
||||
*/
|
||||
updateAvailableSidebars = function() {
|
||||
var $sidebarItems = $moveWidgetArea.find( 'li' ), selfSidebarItem;
|
||||
var $sidebarItems = $moveWidgetArea.find( 'li' ), selfSidebarItem,
|
||||
renderedSidebarCount = 0;
|
||||
|
||||
selfSidebarItem = $sidebarItems.filter( function(){
|
||||
return $( this ).data( 'id' ) === self.params.sidebar_id;
|
||||
|
@ -629,23 +630,27 @@
|
|||
|
||||
$sidebarItems.each( function() {
|
||||
var li = $( this ),
|
||||
sidebarId,
|
||||
sidebar;
|
||||
sidebarId, sidebar, sidebarIsRendered;
|
||||
|
||||
sidebarId = li.data( 'id' );
|
||||
sidebar = api.Widgets.registeredSidebars.get( sidebarId );
|
||||
sidebarIsRendered = sidebar.get( 'is_rendered' );
|
||||
|
||||
li.toggle( sidebar.get( 'is_rendered' ) );
|
||||
li.toggle( sidebarIsRendered );
|
||||
|
||||
if ( li.hasClass( 'selected' ) && ! sidebar.get( 'is_rendered' ) ) {
|
||||
if ( sidebarIsRendered ) {
|
||||
renderedSidebarCount += 1;
|
||||
}
|
||||
|
||||
if ( li.hasClass( 'selected' ) && ! sidebarIsRendered ) {
|
||||
selectSidebarItem( selfSidebarItem );
|
||||
}
|
||||
} );
|
||||
|
||||
if ( 1 === $sidebarItems.length ) {
|
||||
self.container.find( '.move-widget' ).hide();
|
||||
} else {
|
||||
if ( renderedSidebarCount > 1 ) {
|
||||
self.container.find( '.move-widget' ).show();
|
||||
} else {
|
||||
self.container.find( '.move-widget' ).hide();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31418';
|
||||
$wp_version = '4.2-alpha-31419';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue