Customizer: In nav menus show the location name instead of slug.

Props ryankienstra.
Fixes #34755.
Built from https://develop.svn.wordpress.org/trunk@36573


git-svn-id: http://core.svn.wordpress.org/trunk@36540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-02-18 17:16:27 +00:00
parent 7ee69ca8d1
commit 658d825ea9
4 changed files with 14 additions and 10 deletions

View File

@ -24,7 +24,8 @@
defaultSettingValues: {
nav_menu: {},
nav_menu_item: {}
}
},
locationSlugMappedToName: {}
};
if ( 'undefined' !== typeof _wpCustomizeNavMenusSettings ) {
$.extend( api.Menus.data, _wpCustomizeNavMenusSettings );
@ -805,19 +806,21 @@
/**
* @param {array} themeLocations
*/
updateAssignedLocationsInSectionTitle: function( themeLocations ) {
updateAssignedLocationsInSectionTitle: function( themeLocationSlugs ) {
var section = this,
$title;
$title = section.container.find( '.accordion-section-title:first' );
$title.find( '.menu-in-location' ).remove();
_.each( themeLocations, function( themeLocation ) {
var $label = $( '<span class="menu-in-location"></span>' );
$label.text( api.Menus.data.l10n.menuLocation.replace( '%s', themeLocation ) );
_.each( themeLocationSlugs, function( themeLocationSlug ) {
var $label, locationName;
$label = $( '<span class="menu-in-location"></span>' );
locationName = api.Menus.data.locationSlugMappedToName[ themeLocationSlug ];
$label.text( api.Menus.data.l10n.menuLocation.replace( '%s', locationName ) );
$title.append( $label );
});
section.container.toggleClass( 'assigned-to-menu-location', 0 !== themeLocations.length );
section.container.toggleClass( 'assigned-to-menu-location', 0 !== themeLocationSlugs.length );
},

File diff suppressed because one or more lines are too long

View File

@ -350,7 +350,7 @@ final class WP_Customize_Nav_Menus {
'untitled' => _x( '(no label)', 'missing menu item navigation label' ),
'unnamed' => _x( '(unnamed)', 'Missing menu name.' ),
'custom_label' => __( 'Custom Link' ),
/* translators: %s: menu location slug */
/* translators: %s: menu location */
'menuLocation' => _x( '(Currently set to: %s)', 'menu' ),
'menuNameLabel' => __( 'Menu Name' ),
'itemAdded' => __( 'Menu item added' ),
@ -381,6 +381,7 @@ final class WP_Customize_Nav_Menus {
'nav_menu' => $temp_nav_menu_setting->default,
'nav_menu_item' => $temp_nav_menu_item_setting->default,
),
'locationSlugMappedToName' => get_registered_nav_menus(),
);
$data = sprintf( 'var _wpCustomizeNavMenusSettings = %s;', wp_json_encode( $settings ) );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-36572';
$wp_version = '4.5-alpha-36573';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.