Replace QuickPress labels with gray prompt texts. Stylish, but also done for localization purposes (string lengths). props ocean90. fixes #21754.

git-svn-id: http://core.svn.wordpress.org/trunk@21894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-18 18:45:44 +00:00
parent bfb48f1384
commit cfdab676fa
5 changed files with 65 additions and 77 deletions

View File

@ -78,10 +78,6 @@ div#dashboard-widgets {
padding-left: 1px; padding-left: 1px;
} }
#dashboard_quick_press h4 {
text-align: right;
}
.tagchecklist span a { .tagchecklist span a {
margin: 4px -9px 0 0; margin: 4px -9px 0 0;
} }

View File

@ -1850,41 +1850,12 @@ a.rsswidget,
} }
/* QuickPress */ /* QuickPress */
#dashboard_quick_press h4 {
float: right;
text-align: left;
}
#dashboard_quick_press .wp-media-buttons {
margin: 0 5em 0.5em 0;
}
#dashboard_quick_press h4 label {
margin-right: 0;
margin-left: 10px;
}
#dashboard_quick_press .input-text-wrap,
#dashboard_quick_press .textarea-wrap {
margin: 0 5em 1em 0;
}
#dashboard_quick_press #media-buttons {
margin: 0 5em .5em 0;
padding: 0;
}
#dashboard-widgets #dashboard_quick_press form p.submit {
margin-left: 0;
margin-right: 4.6em;
}
#dashboard-widgets #dashboard_quick_press form p.submit input { #dashboard-widgets #dashboard_quick_press form p.submit input {
float: right; float: right;
} }
#dashboard-widgets #dashboard_quick_press form p.submit #save-post { #dashboard-widgets #dashboard_quick_press form p.submit #save-post {
margin: 0 10px 0 1em; margin: 0 0 0 1em;
} }
#dashboard-widgets #dashboard_quick_press form p.submit #publish { #dashboard-widgets #dashboard_quick_press form p.submit #publish {

View File

@ -2810,7 +2810,10 @@ table .inline-edit-row fieldset ul.cat-hover {
position: relative; position: relative;
margin-bottom: 10px; margin-bottom: 10px;
} }
#titlediv label { cursor: text; }
#titlediv label {
cursor: text;
}
#titlediv div.inside { #titlediv div.inside {
margin: 0; margin: 0;
@ -6049,27 +6052,48 @@ h3:hover .edit-box {
} }
/* QuickPress */ /* QuickPress */
#dashboard_quick_press h4 { #dashboard_quick_press .input-text-wrap {
font-family: sans-serif; position: relative;
float: left;
width: 5em;
clear: both;
font-weight: normal;
text-align: right;
font-size: 12px;
} }
#dashboard_quick_press h4 label { #dashboard_quick_press .prompt {
margin-right: 10px; color: #bbb;
position: absolute;
}
#title-wrap label,
#tags-input-wrap label {
cursor: text;
}
#title-wrap #title {
padding: 2px 6px;
font-size: 1.3em;
line-height: 100%;
outline: none;
}
#tags-input-wrap #tags-input {
outline: none;
}
#title-wrap #title-prompt-text {
font-size: 1.3em;
padding: 5px 8px;
}
#tags-input-wrap #tags-input-prompt-text {
font-size: 1em;
padding: 4px 8px;
} }
#dashboard_quick_press .input-text-wrap, #dashboard_quick_press .input-text-wrap,
#dashboard_quick_press .textarea-wrap { #dashboard_quick_press .textarea-wrap {
margin: 0 0 1em 5em; margin: 0 0 1em 0;
} }
#dashboard_quick_press .wp-media-buttons { #dashboard_quick_press .wp-media-buttons {
margin: 0 0 .5em 5em; margin: 0 0 .2em 8px;
padding: 0; padding: 0;
} }
@ -6077,16 +6101,12 @@ h3:hover .edit-box {
color: #777; color: #777;
} }
#dashboard-widgets #dashboard_quick_press form p.submit {
margin-left: 4.6em;
}
#dashboard-widgets #dashboard_quick_press form p.submit input { #dashboard-widgets #dashboard_quick_press form p.submit input {
float: left; float: left;
} }
#dashboard-widgets #dashboard_quick_press form p.submit #save-post { #dashboard-widgets #dashboard_quick_press form p.submit #save-post {
margin: 0 0.3em 0 5px; margin: 0 1em 0 0;
} }
#dashboard-widgets #dashboard_quick_press form p.submit #publish { #dashboard-widgets #dashboard_quick_press form p.submit #publish {
@ -8109,17 +8129,6 @@ a.widget-control-edit {
.locale-zh-cn #sort-buttons { font-size: 1em !important; } .locale-zh-cn #sort-buttons { font-size: 1em !important; }
/* ru_RU: Text needs more room to breathe. */ /* ru_RU: Text needs more room to breathe. */
.locale-ru-ru #dashboard_quick_press .input-text-wrap,
.locale-ru-ru #dashboard_quick_press .textarea-wrap,
.locale-ru-ru #dashboard_quick_press .wp-media-buttons {
margin-left: 5.7em; /* default 5em + 0.7em */
}
.locale-ru-ru #dashboard_quick_press h4 {
width: 5.7em; /* default 5.5em + 0.2em */
}
.locale-ru-ru #dashboard-widgets #dashboard_quick_press form p.submit {
margin-left: 5.3em; /* default 4.6em + 0.7em */
}
.locale-ru-ru .inline-edit-row fieldset label span.title { .locale-ru-ru .inline-edit-row fieldset label span.title {
width: auto; /* default 5em */ width: auto; /* default 5em */
min-width: 5em; min-width: 5em;
@ -8134,15 +8143,7 @@ a.widget-control-edit {
width: 245px; /* default 200px + 45px */ width: 245px; /* default 200px + 45px */
} }
/* lt_LT: QuickPress + QuickEdit */ /* lt_LT: QuickEdit */
.locale-lt-lt #dashboard_quick_press .input-text-wrap,
.locale-lt-lt #dashboard_quick_press .textarea-wrap,
.locale-lt-lt #dashboard_quick_press .wp-media-buttons {
margin-left: 7em;
}
.locale-lt-lt #dashboard_quick_press h4 {
width: 7em;
}
.locale-lt-lt .inline-edit-row fieldset label span.title { .locale-lt-lt .inline-edit-row fieldset label span.title {
width: 8em; width: 8em;
} }

View File

@ -503,8 +503,8 @@ function wp_dashboard_quick_press() {
?> ?>
<form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press"> <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press">
<h4 id="quick-post-title"><label for="title"><?php _e('Title') ?></label></h4> <div class="input-text-wrap" id="title-wrap">
<div class="input-text-wrap"> <label class="screen-reader-text prompt" for="title" id="title-prompt-text"><?php _e( 'Enter title here' ); ?></label>
<input type="text" name="post_title" id="title" autocomplete="off" value="<?php echo esc_attr( $post->post_title ); ?>" /> <input type="text" name="post_title" id="title" autocomplete="off" value="<?php echo esc_attr( $post->post_title ); ?>" />
</div> </div>
@ -514,15 +514,15 @@ function wp_dashboard_quick_press() {
</div> </div>
<?php endif; ?> <?php endif; ?>
<h4 id="content-label"><label for="content"><?php _e('Content') ?></label></h4>
<div class="textarea-wrap"> <div class="textarea-wrap">
<label class="screen-reader-text" for="content"><?php _e( 'Content' ); ?></label>
<textarea name="content" id="content" class="mceEditor" rows="3" cols="15"><?php echo esc_textarea( $post->post_content ); ?></textarea> <textarea name="content" id="content" class="mceEditor" rows="3" cols="15"><?php echo esc_textarea( $post->post_content ); ?></textarea>
</div> </div>
<script type="text/javascript">edCanvas = document.getElementById('content');edInsertContent = null;</script> <script type="text/javascript">edCanvas = document.getElementById('content');edInsertContent = null;</script>
<h4><label for="tags-input"><?php _e('Tags') ?></label></h4> <div class="input-text-wrap" id="tags-input-wrap">
<div class="input-text-wrap"> <label class="screen-reader-text prompt" for="tags-input" id="tags-input-prompt-text"><?php _e( 'Tags (separate with commas)' ); ?></label>
<input type="text" name="tags_input" id="tags-input" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /> <input type="text" name="tags_input" id="tags-input" value="<?php echo get_tags_to_edit( $post->ID ); ?>" />
</div> </div>

View File

@ -87,6 +87,26 @@ jQuery(document).ready( function($) {
$('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } );
$('#title, #tags-input').each( function() {
var input = $(this), prompt = $('#' + this.id + '-prompt-text');
if ( '' === this.value )
prompt.removeClass('screen-reader-text');
prompt.click( function() {
$(this).addClass('screen-reader-text');
input.focus();
});
input.blur( function() {
if ( '' === this.value )
prompt.removeClass('screen-reader-text');
});
input.focus( function() {
prompt.addClass('screen-reader-text');
});
});
}; };
quickPressLoad(); quickPressLoad();