Customizer: Use "(Untitled)" as site title if blogname is empty.

Fixes a layout issue in the Customizer UI. Also de-duplicate title display logic, outputting "Loading..." as site title in PHP with actual title being set upon Customizer `ready`. Also update the site title in response to a `blogname` setting change as opposed to `input` DOM events on the control.

Fixes .


git-svn-id: https://develop.svn.wordpress.org/trunk@36388 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2016-01-23 23:14:10 +00:00
parent e1b5d2d2bf
commit b07466c2bf
3 changed files with 8 additions and 3 deletions

@ -132,7 +132,7 @@ do_action( 'customize_controls_print_scripts' );
<div id="customize-info" class="accordion-section customize-info">
<div class="accordion-section-title">
<span class="preview-notice"><?php
echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name' ) . '</strong>' );
echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . __( 'Loading&hellip;' ) . '</strong>' );
?></span>
<button class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
</div>

@ -3604,8 +3604,12 @@
// Bind site title display to the corresponding field.
if ( title.length ) {
$( '#customize-control-blogname input' ).on( 'input', function() {
title.text( this.value );
api( 'blogname', function( setting ) {
var updateTitle = function() {
title.text( $.trim( setting() ) || api.l10n.untitledBlogName );
};
setting.bind( updateTitle );
updateTitle();
} );
}

@ -443,6 +443,7 @@ function wp_default_scripts( &$scripts ) {
'loginIframeTitle' => __( 'Session expired' ),
'collapseSidebar' => __( 'Collapse Sidebar' ),
'expandSidebar' => __( 'Expand Sidebar' ),
'untitledBlogName' => __( '(Untitled)' ),
// Used for overriding the file types allowed in plupload.
'allowedFiles' => __( 'Allowed Files' ),
) );