WordPress.org

Make WordPress Core

Changeset 39378


Ignore:
Timestamp:
11/30/2016 06:00:53 PM (2 years ago)
Author:
westonruter
Message:

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

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

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/customize-nav-menus.css

    r38906 r39378  
    302302}
    303303
    304 #accordion-panel-nav_menus .field-link-target,
    305 #accordion-panel-nav_menus .field-title-attribute,
    306 #accordion-panel-nav_menus .field-css-classes,
    307 #accordion-panel-nav_menus .field-xfn,
    308 #accordion-panel-nav_menus .field-description {
    309     display: none;
    310 }
    311 
    312 #accordion-panel-nav_menus.field-link-target-active .field-link-target,
    313 #accordion-panel-nav_menus.field-title-attribute-active .field-title-attribute,
    314 #accordion-panel-nav_menus.field-css-classes-active .field-css-classes,
    315 #accordion-panel-nav_menus.field-xfn-active .field-xfn,
    316 #accordion-panel-nav_menus.field-description-active .field-description {
     304.control-section-nav_menu .field-link-target,
     305.control-section-nav_menu .field-title-attribute,
     306.control-section-nav_menu .field-css-classes,
     307.control-section-nav_menu .field-xfn,
     308.control-section-nav_menu .field-description {
     309    display: none;
     310}
     311
     312.control-section-nav_menu.field-link-target-active .field-link-target,
     313.control-section-nav_menu.field-title-attribute-active .field-title-attribute,
     314.control-section-nav_menu.field-css-classes-active .field-css-classes,
     315.control-section-nav_menu.field-xfn-active .field-xfn,
     316.control-section-nav_menu.field-description-active .field-description {
    317317    display: block;
    318318}
  • trunk/src/wp-admin/js/customize-nav-menus.js

    r39376 r39378  
    787787
    788788        /**
    789          * Show/hide/save screen options (columns). From common.js.
     789         * Update field visibility when clicking on the field toggles.
    790790         */
    791791        ready: function() {
    792792            var panel = this;
    793             this.container.find( '.hide-column-tog' ).click( function() {
    794                 var $t = $( this ), column = $t.val();
    795                 if ( $t.prop( 'checked' ) ) {
    796                     panel.checked( column );
    797                 } else {
    798                     panel.unchecked( column );
    799                 }
    800 
     793            panel.container.find( '.hide-column-tog' ).click( function() {
    801794                panel.saveManageColumnsState();
    802795            });
    803             this.container.find( '.hide-column-tog' ).each( function() {
    804             var $t = $( this ), column = $t.val();
    805                 if ( $t.prop( 'checked' ) ) {
    806                     panel.checked( column );
    807                 } else {
    808                     panel.unchecked( column );
    809                 }
    810             });
    811         },
    812 
     796        },
     797
     798        /**
     799         * Save hidden column states.
     800         *
     801         * @since 4.3.0
     802         * @private
     803         *
     804         * @returns {void}
     805         */
    813806        saveManageColumnsState: _.debounce( function() {
    814807            var panel = this;
     
    827820        }, 2000 ),
    828821
    829         checked: function( column ) {
    830             this.container.addClass( 'field-' + column + '-active' );
    831         },
    832 
    833         unchecked: function( column ) {
    834             this.container.removeClass( 'field-' + column + '-active' );
    835         },
    836 
     822        /**
     823         * @deprecated Since 4.7.0 now that the nav_menu sections are responsible for toggling the classes on their own containers.
     824         */
     825        checked: function() {},
     826
     827        /**
     828         * @deprecated Since 4.7.0 now that the nav_menu sections are responsible for toggling the classes on their own containers.
     829         */
     830        unchecked: function() {},
     831
     832        /**
     833         * Get hidden fields.
     834         *
     835         * @since 4.3.0
     836         * @private
     837         *
     838         * @returns {Array} Fields (columns) that are hidden.
     839         */
    837840        hidden: function() {
    838841            return $( '.hide-column-tog' ).not( ':checked' ).map( function() {
     
    872875         */
    873876        ready: function() {
    874             var section = this;
     877            var section = this, fieldActiveToggles, handleFieldActiveToggle;
    875878
    876879            if ( 'undefined' === typeof section.params.menu_id ) {
     
    924927                section.container.find( '.menu-item.move-right-disabled .menus-move-right' ).attr({ 'tabindex': '-1', 'aria-hidden': 'true' });
    925928            } );
     929
     930            /**
     931             * Update the active field class for the content container for a given checkbox toggle.
     932             *
     933             * @this {jQuery}
     934             * @returns {void}
     935             */
     936            handleFieldActiveToggle = function() {
     937                var className = 'field-' + $( this ).val() + '-active';
     938                section.contentContainer.toggleClass( className, $( this ).prop( 'checked' ) );
     939            };
     940            fieldActiveToggles = api.panel( 'nav_menus' ).contentContainer.find( '.metabox-prefs:first' ).find( '.hide-column-tog' );
     941            fieldActiveToggles.each( handleFieldActiveToggle );
     942            fieldActiveToggles.on( 'click', handleFieldActiveToggle );
    926943        },
    927944
Note: See TracChangeset for help on using the changeset viewer.