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:
Dominik Schilling 2015-02-11 20:45:26 +00:00
parent 44ac816aed
commit 6adb5c0618
3 changed files with 15 additions and 10 deletions

View File

@ -621,7 +621,8 @@
* Update available sidebars when their rendered state changes * Update available sidebars when their rendered state changes
*/ */
updateAvailableSidebars = function() { updateAvailableSidebars = function() {
var $sidebarItems = $moveWidgetArea.find( 'li' ), selfSidebarItem; var $sidebarItems = $moveWidgetArea.find( 'li' ), selfSidebarItem,
renderedSidebarCount = 0;
selfSidebarItem = $sidebarItems.filter( function(){ selfSidebarItem = $sidebarItems.filter( function(){
return $( this ).data( 'id' ) === self.params.sidebar_id; return $( this ).data( 'id' ) === self.params.sidebar_id;
@ -629,23 +630,27 @@
$sidebarItems.each( function() { $sidebarItems.each( function() {
var li = $( this ), var li = $( this ),
sidebarId, sidebarId, sidebar, sidebarIsRendered;
sidebar;
sidebarId = li.data( 'id' ); sidebarId = li.data( 'id' );
sidebar = api.Widgets.registeredSidebars.get( sidebarId ); 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 ); selectSidebarItem( selfSidebarItem );
} }
} ); } );
if ( 1 === $sidebarItems.length ) { if ( renderedSidebarCount > 1 ) {
self.container.find( '.move-widget' ).hide();
} else {
self.container.find( '.move-widget' ).show(); self.container.find( '.move-widget' ).show();
} else {
self.container.find( '.move-widget' ).hide();
} }
}; };

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.