mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 07:07:04 +00:00
Customize: Fix persistence of toggles for displayed nav menu item properties.
* Eliminates need to click more than one checkbox to have preferences saved. * Adds debouncing to saving user-selected menu item properties. * Also removes discrepancies between available nav menu item properties on admin page vs Customizer. Fixes #35273. Props afercia, westonruter. git-svn-id: https://develop.svn.wordpress.org/trunk@36908 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -218,7 +218,7 @@
|
||||
.prop( 'tabIndex', -1 )
|
||||
.removeClass( 'is-visible' );
|
||||
}
|
||||
|
||||
|
||||
this.searchTerm = event.target.value;
|
||||
this.pages.search = 1;
|
||||
this.doSearch( 1 );
|
||||
@@ -614,15 +614,21 @@
|
||||
});
|
||||
},
|
||||
|
||||
saveManageColumnsState: function() {
|
||||
var hidden = this.hidden();
|
||||
$.post( wp.ajax.settings.url, {
|
||||
action: 'hidden-columns',
|
||||
hidden: hidden,
|
||||
saveManageColumnsState: _.debounce( function() {
|
||||
var panel = this;
|
||||
if ( panel._updateHiddenColumnsRequest ) {
|
||||
panel._updateHiddenColumnsRequest.abort();
|
||||
}
|
||||
|
||||
panel._updateHiddenColumnsRequest = wp.ajax.post( 'hidden-columns', {
|
||||
hidden: panel.hidden(),
|
||||
screenoptionnonce: $( '#screenoptionnonce' ).val(),
|
||||
page: 'nav-menus'
|
||||
});
|
||||
},
|
||||
} );
|
||||
panel._updateHiddenColumnsRequest.always( function() {
|
||||
panel._updateHiddenColumnsRequest = null;
|
||||
} );
|
||||
}, 2000 ),
|
||||
|
||||
checked: function( column ) {
|
||||
this.container.addClass( 'field-' + column + '-active' );
|
||||
@@ -633,12 +639,10 @@
|
||||
},
|
||||
|
||||
hidden: function() {
|
||||
this.hidden = function() {
|
||||
return $( '.hide-column-tog' ).not( ':checked' ).map( function() {
|
||||
var id = this.id;
|
||||
return id.substring( id, id.length - 5 );
|
||||
}).get().join( ',' );
|
||||
};
|
||||
return $( '.hide-column-tog' ).not( ':checked' ).map( function() {
|
||||
var id = this.id;
|
||||
return id.substring( 0, id.length - 5 );
|
||||
}).get().join( ',' );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user