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;
}
#accordion-panel-nav_menus .field-link-target,
#accordion-panel-nav_menus .field-title-attribute,
#accordion-panel-nav_menus .field-css-classes,
#accordion-panel-nav_menus .field-xfn,
#accordion-panel-nav_menus .field-description {
.control-section-nav_menu .field-link-target,
.control-section-nav_menu .field-title-attribute,
.control-section-nav_menu .field-css-classes,
.control-section-nav_menu .field-xfn,
.control-section-nav_menu .field-description {
display: none;
}
#accordion-panel-nav_menus.field-link-target-active .field-link-target,
#accordion-panel-nav_menus.field-title-attribute-active .field-title-attribute,
#accordion-panel-nav_menus.field-css-classes-active .field-css-classes,
#accordion-panel-nav_menus.field-xfn-active .field-xfn,
#accordion-panel-nav_menus.field-description-active .field-description {
.control-section-nav_menu.field-link-target-active .field-link-target,
.control-section-nav_menu.field-title-attribute-active .field-title-attribute,
.control-section-nav_menu.field-css-classes-active .field-css-classes,
.control-section-nav_menu.field-xfn-active .field-xfn,
.control-section-nav_menu.field-description-active .field-description {
display: block;
}

File diff suppressed because one or more lines are too long

View File

@ -301,19 +301,19 @@
text-decoration: none !important;
}
#accordion-panel-nav_menus .field-link-target,
#accordion-panel-nav_menus .field-title-attribute,
#accordion-panel-nav_menus .field-css-classes,
#accordion-panel-nav_menus .field-xfn,
#accordion-panel-nav_menus .field-description {
.control-section-nav_menu .field-link-target,
.control-section-nav_menu .field-title-attribute,
.control-section-nav_menu .field-css-classes,
.control-section-nav_menu .field-xfn,
.control-section-nav_menu .field-description {
display: none;
}
#accordion-panel-nav_menus.field-link-target-active .field-link-target,
#accordion-panel-nav_menus.field-title-attribute-active .field-title-attribute,
#accordion-panel-nav_menus.field-css-classes-active .field-css-classes,
#accordion-panel-nav_menus.field-xfn-active .field-xfn,
#accordion-panel-nav_menus.field-description-active .field-description {
.control-section-nav_menu.field-link-target-active .field-link-target,
.control-section-nav_menu.field-title-attribute-active .field-title-attribute,
.control-section-nav_menu.field-css-classes-active .field-css-classes,
.control-section-nav_menu.field-xfn-active .field-xfn,
.control-section-nav_menu.field-description-active .field-description {
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() {
var panel = this;
this.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.container.find( '.hide-column-tog' ).click( function() {
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() {
var panel = this;
if ( panel._updateHiddenColumnsRequest ) {
@ -826,14 +819,24 @@
} );
}, 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() {
return $( '.hide-column-tog' ).not( ':checked' ).map( function() {
var id = this.id;
@ -871,7 +874,7 @@
* Ready.
*/
ready: function() {
var section = this;
var section = this, fieldActiveToggles, handleFieldActiveToggle;
if ( 'undefined' === typeof section.params.menu_id ) {
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-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() {

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @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.