Customize: Improve flow from menu locations to editing a menu.
Adds an Edit button beside the menu location to allow users to switch to the selected menu for further edits. Props celloexpressions. Fixes #36795. git-svn-id: https://develop.svn.wordpress.org/trunk@37901 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c174aa2b6f
commit
3fff76a15f
@ -16,6 +16,10 @@
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.customize-control-nav_menu_location .edit-menu {
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.wp-customizer .menu-item-bar .menu-item-handle,
|
||||
.wp-customizer .menu-item-settings,
|
||||
.wp-customizer .menu-item-settings .description-thin {
|
||||
|
@ -926,6 +926,19 @@
|
||||
return parseInt( value, 10 );
|
||||
};
|
||||
|
||||
// Edit menu button.
|
||||
control.container.find( '.edit-menu' ).on( 'click', function() {
|
||||
var menuId = control.setting();
|
||||
api.section( 'nav_menu[' + menuId + ']' ).focus();
|
||||
});
|
||||
control.setting.bind( 'change', function() {
|
||||
if ( 0 === control.setting() ) {
|
||||
control.container.find( '.edit-menu' ).addClass( 'hidden' );
|
||||
} else {
|
||||
control.container.find( '.edit-menu' ).removeClass( 'hidden' );
|
||||
}
|
||||
});
|
||||
|
||||
// Add/remove menus from the available options when they are added and removed.
|
||||
api.bind( 'add', function( setting ) {
|
||||
var option, menuId, matches = setting.id.match( navMenuIdRegex );
|
||||
|
@ -77,6 +77,7 @@ class WP_Customize_Nav_Menu_Location_Control extends WP_Customize_Control {
|
||||
?>
|
||||
</select>
|
||||
</label>
|
||||
<button type="button" class="button edit-menu<?php if ( ! $this->value() ) { echo ' hidden'; } ?>"><?php _e( 'Edit' ); ?></button>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user