From 0ed85414399f1c93bef74c845a753d82f4c4cafd Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 18 Sep 2012 18:45:44 +0000 Subject: [PATCH] Replace QuickPress labels with gray prompt texts. Stylish, but also done for localization purposes (string lengths). props ocean90. fixes #21754. git-svn-id: https://develop.svn.wordpress.org/trunk@21894 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/css/ie-rtl.css | 4 -- wp-admin/css/wp-admin-rtl.css | 31 +------------ wp-admin/css/wp-admin.css | 77 +++++++++++++++++---------------- wp-admin/includes/dashboard.php | 10 ++--- wp-admin/js/dashboard.js | 20 +++++++++ 5 files changed, 65 insertions(+), 77 deletions(-) diff --git a/wp-admin/css/ie-rtl.css b/wp-admin/css/ie-rtl.css index 4fb89de7c1..a62928ab4d 100644 --- a/wp-admin/css/ie-rtl.css +++ b/wp-admin/css/ie-rtl.css @@ -78,10 +78,6 @@ div#dashboard-widgets { padding-left: 1px; } -#dashboard_quick_press h4 { - text-align: right; -} - .tagchecklist span a { margin: 4px -9px 0 0; } diff --git a/wp-admin/css/wp-admin-rtl.css b/wp-admin/css/wp-admin-rtl.css index 3ff5651ee3..7fb308b9c5 100644 --- a/wp-admin/css/wp-admin-rtl.css +++ b/wp-admin/css/wp-admin-rtl.css @@ -1850,41 +1850,12 @@ a.rsswidget, } /* 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 { float: right; } #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 { diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css index f502326043..15287ddc13 100644 --- a/wp-admin/css/wp-admin.css +++ b/wp-admin/css/wp-admin.css @@ -2810,7 +2810,10 @@ table .inline-edit-row fieldset ul.cat-hover { position: relative; margin-bottom: 10px; } -#titlediv label { cursor: text; } + +#titlediv label { + cursor: text; +} #titlediv div.inside { margin: 0; @@ -6049,27 +6052,48 @@ h3:hover .edit-box { } /* QuickPress */ -#dashboard_quick_press h4 { - font-family: sans-serif; - float: left; - width: 5em; - clear: both; - font-weight: normal; - text-align: right; - font-size: 12px; +#dashboard_quick_press .input-text-wrap { + position: relative; } -#dashboard_quick_press h4 label { - margin-right: 10px; +#dashboard_quick_press .prompt { + 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 .textarea-wrap { - margin: 0 0 1em 5em; + margin: 0 0 1em 0; } #dashboard_quick_press .wp-media-buttons { - margin: 0 0 .5em 5em; + margin: 0 0 .2em 8px; padding: 0; } @@ -6077,16 +6101,12 @@ h3:hover .edit-box { color: #777; } -#dashboard-widgets #dashboard_quick_press form p.submit { - margin-left: 4.6em; -} - #dashboard-widgets #dashboard_quick_press form p.submit input { float: left; } #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 { @@ -8109,17 +8129,6 @@ a.widget-control-edit { .locale-zh-cn #sort-buttons { font-size: 1em !important; } /* 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 { width: auto; /* default 5em */ min-width: 5em; @@ -8134,15 +8143,7 @@ a.widget-control-edit { width: 245px; /* default 200px + 45px */ } -/* lt_LT: QuickPress + 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; -} +/* lt_LT: QuickEdit */ .locale-lt-lt .inline-edit-row fieldset label span.title { width: 8em; } diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 678418c47a..1cc3c813df 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -503,8 +503,8 @@ function wp_dashboard_quick_press() { ?>
-

-
+
+
@@ -514,15 +514,15 @@ function wp_dashboard_quick_press() {
-

+
-

-
+
+
diff --git a/wp-admin/js/dashboard.js b/wp-admin/js/dashboard.js index 6709ba7bde..32084469ad 100644 --- a/wp-admin/js/dashboard.js +++ b/wp-admin/js/dashboard.js @@ -87,6 +87,26 @@ jQuery(document).ready( function($) { $('#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();