Customize: Fix regression in ability to hide fields for advanced menu properties in nav menu item controls.

Props westonruter, celloexpressions.
See #34391.
Fixes #38952.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-11-30 18:01:43 +00:00
parent b2c12e463a
commit b2c65c9a95
7 changed files with 66 additions and 49 deletions

View File

@ -301,19 +301,19 @@
text-decoration: none !important; text-decoration: none !important;
} }
#accordion-panel-nav_menus .field-link-target, .control-section-nav_menu .field-link-target,
#accordion-panel-nav_menus .field-title-attribute, .control-section-nav_menu .field-title-attribute,
#accordion-panel-nav_menus .field-css-classes, .control-section-nav_menu .field-css-classes,
#accordion-panel-nav_menus .field-xfn, .control-section-nav_menu .field-xfn,
#accordion-panel-nav_menus .field-description { .control-section-nav_menu .field-description {
display: none; display: none;
} }
#accordion-panel-nav_menus.field-link-target-active .field-link-target, .control-section-nav_menu.field-link-target-active .field-link-target,
#accordion-panel-nav_menus.field-title-attribute-active .field-title-attribute, .control-section-nav_menu.field-title-attribute-active .field-title-attribute,
#accordion-panel-nav_menus.field-css-classes-active .field-css-classes, .control-section-nav_menu.field-css-classes-active .field-css-classes,
#accordion-panel-nav_menus.field-xfn-active .field-xfn, .control-section-nav_menu.field-xfn-active .field-xfn,
#accordion-panel-nav_menus.field-description-active .field-description { .control-section-nav_menu.field-description-active .field-description {
display: block; display: block;
} }

File diff suppressed because one or more lines are too long

View File

@ -301,19 +301,19 @@
text-decoration: none !important; text-decoration: none !important;
} }
#accordion-panel-nav_menus .field-link-target, .control-section-nav_menu .field-link-target,
#accordion-panel-nav_menus .field-title-attribute, .control-section-nav_menu .field-title-attribute,
#accordion-panel-nav_menus .field-css-classes, .control-section-nav_menu .field-css-classes,
#accordion-panel-nav_menus .field-xfn, .control-section-nav_menu .field-xfn,
#accordion-panel-nav_menus .field-description { .control-section-nav_menu .field-description {
display: none; display: none;
} }
#accordion-panel-nav_menus.field-link-target-active .field-link-target, .control-section-nav_menu.field-link-target-active .field-link-target,
#accordion-panel-nav_menus.field-title-attribute-active .field-title-attribute, .control-section-nav_menu.field-title-attribute-active .field-title-attribute,
#accordion-panel-nav_menus.field-css-classes-active .field-css-classes, .control-section-nav_menu.field-css-classes-active .field-css-classes,
#accordion-panel-nav_menus.field-xfn-active .field-xfn, .control-section-nav_menu.field-xfn-active .field-xfn,
#accordion-panel-nav_menus.field-description-active .field-description { .control-section-nav_menu.field-description-active .field-description {
display: block; display: block;
} }

File diff suppressed because one or more lines are too long

View File

@ -786,30 +786,23 @@
}, },
/** /**
* Show/hide/save screen options (columns). From common.js. * Update field visibility when clicking on the field toggles.
*/ */
ready: function() { ready: function() {
var panel = this; var panel = this;
this.container.find( '.hide-column-tog' ).click( function() { panel.container.find( '.hide-column-tog' ).click( function() {
var $t = $( this ), column = $t.val();
if ( $t.prop( 'checked' ) ) {
panel.checked( column );
} else {
panel.unchecked( column );
}
panel.saveManageColumnsState(); panel.saveManageColumnsState();
}); });
this.container.find( '.hide-column-tog' ).each( function() {
var $t = $( this ), column = $t.val();
if ( $t.prop( 'checked' ) ) {
panel.checked( column );
} else {
panel.unchecked( column );
}
});
}, },
/**
* Save hidden column states.
*
* @since 4.3.0
* @private
*
* @returns {void}
*/
saveManageColumnsState: _.debounce( function() { saveManageColumnsState: _.debounce( function() {
var panel = this; var panel = this;
if ( panel._updateHiddenColumnsRequest ) { if ( panel._updateHiddenColumnsRequest ) {
@ -826,14 +819,24 @@
} ); } );
}, 2000 ), }, 2000 ),
checked: function( column ) { /**
this.container.addClass( 'field-' + column + '-active' ); * @deprecated Since 4.7.0 now that the nav_menu sections are responsible for toggling the classes on their own containers.
}, */
checked: function() {},
unchecked: function( column ) { /**
this.container.removeClass( 'field-' + column + '-active' ); * @deprecated Since 4.7.0 now that the nav_menu sections are responsible for toggling the classes on their own containers.
}, */
unchecked: function() {},
/**
* Get hidden fields.
*
* @since 4.3.0
* @private
*
* @returns {Array} Fields (columns) that are hidden.
*/
hidden: function() { hidden: function() {
return $( '.hide-column-tog' ).not( ':checked' ).map( function() { return $( '.hide-column-tog' ).not( ':checked' ).map( function() {
var id = this.id; var id = this.id;
@ -871,7 +874,7 @@
* Ready. * Ready.
*/ */
ready: function() { ready: function() {
var section = this; var section = this, fieldActiveToggles, handleFieldActiveToggle;
if ( 'undefined' === typeof section.params.menu_id ) { if ( 'undefined' === typeof section.params.menu_id ) {
throw new Error( 'params.menu_id was not defined' ); throw new Error( 'params.menu_id was not defined' );
@ -923,6 +926,20 @@
section.container.find( '.menu-item.move-left-disabled .menus-move-left' ).attr({ 'tabindex': '-1', 'aria-hidden': 'true' }); section.container.find( '.menu-item.move-left-disabled .menus-move-left' ).attr({ 'tabindex': '-1', 'aria-hidden': 'true' });
section.container.find( '.menu-item.move-right-disabled .menus-move-right' ).attr({ 'tabindex': '-1', 'aria-hidden': 'true' }); section.container.find( '.menu-item.move-right-disabled .menus-move-right' ).attr({ 'tabindex': '-1', 'aria-hidden': 'true' });
} ); } );
/**
* Update the active field class for the content container for a given checkbox toggle.
*
* @this {jQuery}
* @returns {void}
*/
handleFieldActiveToggle = function() {
var className = 'field-' + $( this ).val() + '-active';
section.contentContainer.toggleClass( className, $( this ).prop( 'checked' ) );
};
fieldActiveToggles = api.panel( 'nav_menus' ).contentContainer.find( '.metabox-prefs:first' ).find( '.hide-column-tog' );
fieldActiveToggles.each( handleFieldActiveToggle );
fieldActiveToggles.on( 'click', handleFieldActiveToggle );
}, },
populateControls: function() { populateControls: function() {

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.8-alpha-39376'; $wp_version = '4.8-alpha-39378';
/** /**
* 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.