Admin bar UX improvements. First pass, see #18197

git-svn-id: https://develop.svn.wordpress.org/trunk@18683 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Daryl Koopersmith 2011-09-16 05:01:54 +00:00
parent 461af47e10
commit e1038932b9
18 changed files with 409 additions and 329 deletions

View File

@ -62,7 +62,7 @@ var userSettings = {
thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
isRtl = <?php echo (int) is_rtl(); ?>;
function wp_set_width_class() {
var w = document.body.clientWidth, bc = document.body.className;
@ -118,90 +118,11 @@ wp_set_width_class();
<div id="wpwrap">
<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
<div id="wpcontent">
<div id="wphead">
<?php
if ( is_network_admin() )
$blog_name = sprintf( __('Network Admin: %s'), esc_html($current_site->site_name) );
elseif ( is_user_admin() )
$blog_name = sprintf( __('Global Dashboard: %s'), esc_html($current_site->site_name) );
else
$blog_name = get_bloginfo('name', 'display');
if ( '' == $blog_name ) {
$blog_name = __( 'Visit Site' );
} else {
$blog_name_excerpt = wp_html_excerpt($blog_name, 40);
if ( $blog_name != $blog_name_excerpt )
$blog_name_excerpt = trim($blog_name_excerpt) . '&hellip;';
$blog_name = $blog_name_excerpt;
unset($blog_name_excerpt);
}
$title_class = '';
if ( function_exists('mb_strlen') ) {
if ( mb_strlen($blog_name, 'UTF-8') > 30 )
$title_class = 'class="long-title"';
} else {
if ( strlen($blog_name) > 30 )
$title_class = 'class="long-title"';
}
?>
<img id="header-logo" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" alt="" width="16" height="16" />
<h1 id="site-heading" <?php echo $title_class ?>>
<a href="<?php echo trailingslashit( get_bloginfo( 'url' ) ); ?>" title="<?php esc_attr_e('Visit Site') ?>">
<span id="site-title"><?php echo $blog_name ?></span>
</a>
</h1>
<?php
do_action('in_admin_header');
$links = array();
// Generate user profile and info links.
$links[5] = sprintf( __('Howdy, %1$s'), $user_identity );
$links[8] = '<a href="profile.php" title="' . esc_attr__('Edit your profile') . '">' . __('Your Profile') . '</a>';
if ( is_multisite() && is_super_admin() ) {
if ( !is_network_admin() )
$links[10] = '<a href="' . network_admin_url() . '" title="' . ( ! empty( $update_title ) ? $update_title : esc_attr__('Network Admin') ) . '">' . __('Network Admin') . ( ! empty( $total_update_count ) ? ' (' . number_format_i18n( $total_update_count ) . ')' : '' ) . '</a>';
else
$links[10] = '<a href="' . get_dashboard_url( get_current_user_id() ) . '" title="' . esc_attr__('Site Admin') . '">' . __('Site Admin') . '</a>';
}
$links[15] = '<a href="' . wp_logout_url() . '" title="' . esc_attr__('Log Out') . '">' . __('Log Out') . '</a>';
$links = apply_filters( 'admin_user_info_links', $links, $current_user );
ksort( $links );
// Trim whitespace and pipes from links, then convert to list items.
$links = array_map( 'trim', $links, array_fill( 0, count( $links ), " |\n\t" ) );
$howdy = array_shift( $links );
$links_no_js = implode( ' | ', $links );
$links_js = '<li>' . implode( '</li><li>', $links ) . '</li>';
?>
<div id="wphead-info">
<div id="user_info">
<p class="hide-if-js"><?php echo "$howdy | $links_no_js"; ?></p>
<div class="hide-if-no-js">
<p><?php echo $howdy; ?></p>
<div id="user_info_arrow"></div>
<div id="user_info_links_wrap"><div id="user_info_links">
<ul><?php echo $links_js; ?></ul>
</div></div>
</div>
</div>
</div>
</div>
<div id="wpbody">
<?php
unset($title_class, $blog_name, $total_update_count, $update_title);

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
/*------------------------------------------------------------------------------
Howdy! This is the CSS file that controls the
Howdy! This is the CSS file that controls the
Blue (classic) color style on the WordPress Dashboard.
This file contains both LTR and RTL styles.
@ -1661,14 +1661,6 @@ table.diff .diff-addedline ins {
background-image: linear-gradient(bottom, #eff8ff, #fff); /* proposed W3C Markup */
}
#screen-meta-links a.show-settings {
color: #606060;
}
#screen-meta-links a.show-settings:hover {
color: #000;
}
#replysubmit {
background-color: #f1f1f1;
border-top-color: #ddd;
@ -1894,15 +1886,10 @@ body.press-this ul.category-tabs li.tabs a {
text-decoration: underline;
}
#screen-meta a.show-settings,
.toggle-arrow {
background: transparent url(../images/arrows-vs.png) no-repeat right 3px;
}
#screen-meta .screen-meta-active a.show-settings {
background: transparent url(../images/arrows-vs.png) no-repeat right -33px;
}
.view-switch #view-switch-list {
background: transparent url(../images/list.png) no-repeat 0 0;
}
@ -2253,15 +2240,10 @@ div.widgets-sortables,
background: transparent url(../images/arrows-vs.png) no-repeat 4px 2px;
}
.rtl #screen-meta a.show-settings,
.toggle-arrow {
background: transparent url(../images/arrows-vs.png) no-repeat left 3px;
}
.rtl #screen-meta .screen-meta-active a.show-settings {
background: transparent url(../images/arrows-vs.png) no-repeat left -33px;
}
.rtl .sidebar-name-arrow {
background: transparent url(../images/arrows-vs.png) no-repeat 5px 9px;
}

File diff suppressed because one or more lines are too long

View File

@ -763,6 +763,12 @@ table.widefat span.spam a,
color: #555;
}
#screen-meta {
background-color: #f1f1f1;
border-color: #ccc;
}
.login #backtoblog a {
color: #464646;
}
@ -951,13 +957,13 @@ table.widefat .spam a:hover,
.expanded #adminmenu li.wp-not-current-submenu:hover a.menu-top,
.expanded #adminmenu li.wp-not-current-submenu:hover .wp-menu-arrow {
background-color: #eee; /* Fallback */
background-image: -ms-linear-gradient(bottom, #ccc, #eee); /* IE10 */
background-image: -moz-linear-gradient(bottom, #ccc, #eee); /* Firefox */
background-image: -o-linear-gradient(bottom, #ccc, #eee); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#ccc), to(#eee)); /* old Webkit */
background-color: #e4e4e4; /* Fallback */
background-image: -ms-linear-gradient(bottom, #ccc, #e4e4e4); /* IE10 */
background-image: -moz-linear-gradient(bottom, #ccc, #e4e4e4); /* Firefox */
background-image: -o-linear-gradient(bottom, #ccc, #e4e4e4); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#ccc), to(#e4e4e4)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #ccc, #e4e4e4); /* new Webkit */
background-image: linear-gradient(bottom, #ccc, #eee); /* proposed W3C Markup */
background-image: linear-gradient(bottom, #ccc, #e4e4e4); /* proposed W3C Markup */
border-top-color: #e4e4e4;
border-bottom-color: #ccc;
text-shadow: 0 1px 0 rgba( 255, 255, 255, 0.4 );
@ -1276,34 +1282,6 @@ table.diff .diff-addedline ins {
color: #D54E21;
}
#screen-options-wrap,
#contextual-help-wrap {
background-color: #f1f1f1;
border-color: #dfdfdf;
}
#screen-options-link-wrap,
#contextual-help-link-wrap {
background-color: #e3e3e3; /* Fallback */
border-right: 1px solid transparent;
border-left: 1px solid transparent;
border-bottom: 1px solid transparent;
background-image: -ms-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* IE10 */
background-image: -moz-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Firefox */
background-image: -o-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Opera */
background-image: -webkit-gradient(linear, left bottom, left top, from(#dfdfdf), to(#f1f1f1)); /* old Webkit */
background-image: -webkit-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* new Webkit */
background-image: linear-gradient(bottom, #dfdfdf, #f1f1f1); /* proposed W3C Markup */
}
#screen-meta-links a.show-settings {
color: #777;
}
#screen-meta-links a.show-settings:hover {
color: #000;
}
#replysubmit {
background-color: #f1f1f1;
border-top-color: #ddd;
@ -1534,15 +1512,6 @@ body.press-this ul.category-tabs li.tabs a {
text-decoration: underline;
}
#screen-meta a.show-settings,
.toggle-arrow {
background: transparent url(../images/arrows.png) no-repeat right 3px;
}
#screen-meta .screen-meta-active a.show-settings {
background: transparent url(../images/arrows.png) no-repeat right -33px;
}
.view-switch #view-switch-list {
background: transparent url(../images/list.png) no-repeat 0 0;
}
@ -1886,15 +1855,10 @@ div.widgets-sortables,
background: transparent url(../images/arrows.png) no-repeat 4px 2px;
}
.rtl #screen-meta a.show-settings,
.toggle-arrow {
background: transparent url(../images/arrows.png) no-repeat left 3px;
}
.rtl #screen-meta .screen-meta-active a.show-settings {
background: transparent url(../images/arrows.png) no-repeat left -33px;
}
.rtl .sidebar-name-arrow {
background: transparent url(../images/arrows.png) no-repeat 5px 9px;
}

File diff suppressed because one or more lines are too long

View File

@ -375,21 +375,10 @@ form.upgrade .hint {
6.2 - Screen Options Tabs
------------------------------------------------------------------------------*/
#screen-meta-links {
margin: 0 0 0 19px;
}
#screen-meta .screen-reader-text {
visibility: hidden;
}
#screen-options-link-wrap,
#contextual-help-link-wrap {
float: left;
margin: 0 6px 0 0;
font-family: Tahoma, Arial, sans-serif;
}
#contextual-help-wrap li {
list-style-type: disc;
margin-left: auto;
@ -401,9 +390,6 @@ form.upgrade .hint {
.toggle-arrow-active {
background-position: bottom right;
}
#screen-meta a.show-settings {
padding: 0 6px 0 16px;
}
#screen-options-wrap,
#contextual-help-wrap {

File diff suppressed because one or more lines are too long

View File

@ -543,7 +543,7 @@ code {
}
.wrap {
margin: 0 15px 0 0;
margin: 4px 15px 0 0;
}
div.updated,
@ -1463,8 +1463,7 @@ form.upgrade .hint {
#adminmenu a,
#sidemenu a,
#taglist a,
#catlist a,
#show-settings a {
#catlist a {
text-decoration: none;
}
@ -1574,33 +1573,23 @@ form.upgrade .hint {
------------------------------------------------------------------------------*/
#screen-meta {
position: relative;
clear: both;
}
#screen-meta-links {
margin: 0 24px 0 0;
position: fixed;
max-height: 200px;
top: -250px;
left: 0;
right: 0;
margin-top: 28px;
z-index: 200;
max-height: 200px;
overflow: auto;
border-style: solid;
border-width: 0 0 1px;
}
#screen-meta .screen-reader-text {
visibility: hidden;
}
#screen-options-link-wrap,
#contextual-help-link-wrap {
float: right;
height: 22px;
padding: 0;
margin: 0 0 0 6px;
font-family: sans-serif;
-moz-border-radius-bottomleft: 3px;
-moz-border-radius-bottomright: 3px;
-webkit-border-bottom-left-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
#contextual-help-wrap li {
list-style-type: disc;
margin-left: 18px;
@ -1616,20 +1605,6 @@ form.upgrade .hint {
.toggle-arrow-active {
background-position: bottom left;
}
#screen-meta a.show-settings {
text-decoration: none;
z-index: 1;
padding: 0 16px 0 6px;
height: 22px;
line-height: 22px;
font-size: 12px;
display: block;
text-shadow: rgba(255,255,255,0.7) 0 1px 0;
}
#screen-meta a.show-settings:hover {
text-decoration: none;
}
#screen-options-wrap h5,
#contextual-help-wrap h5 {
@ -1639,10 +1614,7 @@ form.upgrade .hint {
#screen-options-wrap,
#contextual-help-wrap {
border-style: none solid solid;
border-top: 0 none;
border-width: 0 1px 1px;
margin: 0 20px 0 0;
margin: 0;
padding: 8px 12px 12px;
}
@ -2063,7 +2035,7 @@ strong .post-com-count {
8.0 - Layout Blocks
------------------------------------------------------------------------------*/
body.admin-bar #wphead,
body.admin-bar #wpcontent,
body.admin-bar #adminmenu {
padding-top: 28px;
}

View File

@ -1748,6 +1748,11 @@ function screen_meta($screen) {
$show_screen = apply_filters('screen_options_show_screen', $show_screen, $screen);
// If we have screen options, add the menu to the admin bar.
if ( $show_screen )
add_action( 'admin_bar_menu', 'wp_admin_bar_screen_options_menu', 80 );
?>
<div id="screen-meta">
<?php if ( $show_screen ) : ?>
@ -1794,8 +1799,8 @@ function screen_meta($screen) {
echo $screen_options;
echo $settings; ?>
<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
</form>
<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
</form>
</div>
<?php endif; // $show_screen
@ -1820,18 +1825,7 @@ function screen_meta($screen) {
?>
</div>
<div id="screen-meta-links">
<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
<a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a>
</div>
<?php if ( $show_screen ) { ?>
<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
<a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a>
</div>
<?php } ?>
</div>
</div>
<?php
</div> <?php // #screen-meta
}
/**

View File

@ -182,22 +182,33 @@ showNotice = {
};
screenMeta = {
links: {
'screen-options-link-wrap': 'screen-options-wrap',
'contextual-help-link-wrap': 'contextual-help-wrap'
element: null, // #screen-meta
toggles: null, // .screen-meta-toggle
page: null, // #wpcontent, #adminmenu
padding: null, // the closed page padding-top property
top: null, // the closed element top property
map: {
'wp-admin-bar-screen-options': 'screen-options-wrap',
'wp-admin-bar-help': 'contextual-help-wrap'
},
init: function() {
$('.screen-meta-toggle').click( screenMeta.toggleEvent );
screenMeta.element = $('#screen-meta');
screenMeta.toggles = $('.screen-meta-toggle');
screenMeta.page = $('#wpcontent, #adminmenu');
screenMeta.toggles.click( screenMeta.toggleEvent );
},
toggleEvent: function( e ) {
var panel;
e.preventDefault();
// Check to see if we found a panel.
if ( ! screenMeta.links[ this.id ] )
if ( ! screenMeta.map[ this.id ] )
return;
panel = $('#' + screenMeta.links[ this.id ]);
panel = $('#' + screenMeta.map[ this.id ]);
if ( panel.is(':visible') )
screenMeta.close( panel, $(this) );
@ -205,20 +216,29 @@ screenMeta = {
screenMeta.open( panel, $(this) );
},
open: function( panel, link ) {
$('.screen-meta-toggle').not( link ).css('visibility', 'hidden');
// Close open panel
screenMeta.toggles.filter('.selected').click();
panel.slideDown( 'fast', function() {
link.addClass('screen-meta-active');
});
// Open selected panel
link.addClass('selected');
screenMeta.padding = parseInt( screenMeta.page.css('paddingTop'), 10 );
screenMeta.top = parseInt( screenMeta.element.css('top'), 10 );
panel.show();
screenMeta.element.css({ top: 0 });
screenMeta.page.css({ paddingTop: screenMeta.padding + screenMeta.element.outerHeight() });
},
close: function( panel, link ) {
panel.slideUp( 'fast', function() {
link.removeClass('screen-meta-active');
$('.screen-meta-toggle').css('visibility', '');
});
screenMeta.element.css({ top: screenMeta.top });
screenMeta.page.css({ paddingTop: screenMeta.padding });
panel.hide();
link.removeClass('selected');
}
};
$(document).ready( function() {
var lastClicked = false, checks, first, last, checked, dropdown,
pageInput = $('input.current-page'), currentPage = pageInput.val();
@ -231,6 +251,7 @@ $(document).ready( function() {
screenMeta.init();
// User info dropdown.
// @todo: Removed in 3.3; remove me!
dropdown = {
doc: $(document),
element: $('#user_info'),

File diff suppressed because one or more lines are too long

View File

@ -82,10 +82,11 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
if ( 0 != $user_id ) {
/* Add the 'My Account' menu */
$avatar = get_avatar( get_current_user_id(), 16 );
$id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account';
$avatar = get_avatar( get_current_user_id(), 28 );
$id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account';
$howdy = sprintf( __('Howdy, %1$s'), $user_identity );
$wp_admin_bar->add_menu( array( 'id' => $id, 'title' => $avatar . $user_identity, 'href' => get_edit_profile_url( $user_id ) ) );
$wp_admin_bar->add_menu( array( 'id' => $id, 'title' => $howdy . $avatar, 'href' => get_edit_profile_url( $user_id ) ) );
/* Add the "My Account" sub menus */
$wp_admin_bar->add_menu( array( 'id' => 'edit-profile', 'parent' => $id, 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) );
@ -94,21 +95,61 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
}
/**
* Add the "Dashboard"/"Visit Site" menu.
* Add the "Blog Name" menu in the front end.
*
* @since 3.2.0
* @since 3.3.0
*/
function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
$user_id = get_current_user_id();
function wp_admin_bar_blog_front_menu( $wp_admin_bar ) {
$blogname = get_bloginfo('name');
if ( 0 != $user_id ) {
if ( is_admin() )
$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
elseif ( is_multisite() )
$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
else
$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
if ( empty( $blogname ) )
$blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
$wp_admin_bar->add_menu( array(
'id' => 'blog-name',
'title' => $blogname,
'href' => admin_url(),
) );
// Add Dashboard item.
$wp_admin_bar->add_menu( array(
'id' => 'dashboard',
'title' => __( 'Dashboard' ),
'href' => admin_url(),
'parent' => 'blog-name',
) );
wp_admin_bar_appearance_menu( $wp_admin_bar );
}
/**
* Add the "Blog Name" menu in the admin.
*
* @since 3.3.0
*/
function wp_admin_bar_blog_admin_menu( $wp_admin_bar ) {
global $current_site;
if ( is_network_admin() ) {
$title = sprintf( __('Network Admin: %s'), esc_html($current_site->site_name) );
$url = '#';
} elseif ( is_user_admin() ) {
$title = sprintf( __('Global Dashboard: %s'), esc_html($current_site->site_name) );
$url = '#';
} else {
$title = get_bloginfo('name');
$url = get_home_url();
if ( empty( $title ) )
$title = preg_replace( '#^(https?://)?(www.)?#', '', $url );
}
$wp_admin_bar->add_menu( array(
'id' => 'blog-name',
'title' => $title,
'href' => $url,
) );
}
/**
@ -120,17 +161,45 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
global $wpdb;
/* Add the 'My Sites' menu if the user has more than one site. */
if ( count( $wp_admin_bar->user->blogs ) <= 1 )
return;
// if ( count( $wp_admin_bar->user->blogs ) <= 1 )
// return;
$wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Sites' ), 'href' => admin_url( 'my-sites.php' ) ) );
$grey_wp_logo_url = admin_url( 'images/wp-logo.png' );
$default = includes_url('images/wpmini-blue.png');
$grey_wp_logo = '<img src="' . esc_url( $grey_wp_logo_url ) . '" alt="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>';
if ( is_multisite() )
$url = admin_url( 'my-sites.php' );
else
$url = admin_url();
$wp_admin_bar->add_menu( array(
'id' => 'my-blogs',
'title' => $grey_wp_logo,
'href' => $url,
) );
// Add network admin link
if ( is_multisite() && is_super_admin() && ! is_network_admin() ) {
$wp_admin_bar->add_menu( array(
'parent' => 'my-blogs',
'id' => 'network-admin',
'title' => __('Network Admin'),
'href' => network_admin_url(),
) );
}
// Add blog links
$blue_wp_logo_url = includes_url('images/wpmini-blue.png');
foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
// Skip the current blog.
if ( $blog->userblog_id == $wp_admin_bar->user->active_blog->blog_id )
continue;
// @todo Replace with some favicon lookup.
//$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $default ) ) . '" alt="Blavatar" width="16" height="16" />';
$blavatar = '<img src="' . esc_url($default) . '" alt="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>';
//$blavatar = '<img src="' . esc_url( blavatar_url( blavatar_domain( $blog->siteurl ), 'img', 16, $blue_wp_logo_url ) ) . '" alt="Blavatar" width="16" height="16" />';
$blavatar = '<img src="' . esc_url($blue_wp_logo_url) . '" alt="' . esc_attr__( 'Blavatar' ) . '" width="16" height="16" class="blavatar"/>';
$blogname = empty( $blog->blogname ) ? $blog->domain : $blog->blogname;
@ -144,6 +213,14 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
$wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-v', 'title' => __( 'Visit Site' ), 'href' => get_home_url($blog->userblog_id) ) );
}
// Add WordPress.org link
$wp_admin_bar->add_menu( array(
'parent' => 'my-blogs',
'id' => 'wporg',
'title' => __('WordPress.org'),
'href' => 'http://wordpress.org',
) );
}
/**
@ -280,10 +357,18 @@ function wp_admin_bar_comments_menu( $wp_admin_bar ) {
return;
$awaiting_mod = wp_count_comments();
$awaiting_mod = $awaiting_mod->moderated;
$awaiting_mod = number_format_i18n( $awaiting_mod->moderated );
$awaiting_mod = $awaiting_mod ? "<span id='ab-awaiting-mod' class='pending-count'>" . number_format_i18n( $awaiting_mod ) . "</span>" : '';
$wp_admin_bar->add_menu( array( 'id' => 'comments', 'title' => sprintf( __('Comments %s'), $awaiting_mod ), 'href' => admin_url('edit-comments.php') ) );
$bubble = "<div class='ab-comments-bubble'>";
$bubble .= "<div class='ab-comments-count'>$awaiting_mod</div>";
$bubble .= "<div class='ab-comments-arrow'></div>";
$bubble .= "</div>";
$wp_admin_bar->add_menu( array(
'id' => 'comments',
'title' => $bubble,
'href' => admin_url('edit-comments.php'),
) );
}
/**
@ -296,7 +381,12 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
if ( ! current_user_can('switch_themes') && ! current_user_can( 'edit_theme_options' ) )
return;
$wp_admin_bar->add_menu( array( 'id' => 'appearance', 'title' => __('Appearance'), 'href' => admin_url('themes.php') ) );
$wp_admin_bar->add_menu( array(
'id' => 'appearance',
'title' => __('Appearance'),
'href' => admin_url('themes.php'),
'parent' => 'blog-name',
) );
if ( ! current_user_can( 'edit_theme_options' ) )
return;
@ -336,6 +426,64 @@ function wp_admin_bar_updates_menu( $wp_admin_bar ) {
$wp_admin_bar->add_menu( array( 'id' => 'updates', 'title' => $update_title, 'href' => network_admin_url( 'update-core.php' ) ) );
}
/**
* Add screen options link.
*
* @since 3.3.0
*/
function wp_admin_bar_screen_options_menu( $wp_admin_bar ) {
$wp_admin_bar->add_menu( array(
'id' => 'screen-options',
'title' => __('Screen Options'),
'href' => '#',
'meta' => array(
'class' => 'screen-meta-toggle hide-if-no-js',
),
) );
}
/**
* Add help link.
*
* @since 3.3.0
*/
function wp_admin_bar_help_menu( $wp_admin_bar ) {
$wp_admin_bar->add_menu( array(
'id' => 'help',
'title' => __('Help'),
'href' => '#',
'meta' => array(
'class' => 'screen-meta-toggle hide-if-no-js',
),
) );
}
/**
* Add search form.
*
* @since 3.3.0
*/
function wp_admin_bar_search_menu( $wp_admin_bar ) {
$form = '<div id="adminbarsearch-wrap">';
$form .= '<form action="' . home_url() . '" method="get" id="adminbarsearch">';
$form .= '<input class="adminbar-input" name="s" id="adminbar-search"';
$form .= 'type="text" value="" maxlength="150" placeholder="' . esc_attr__( 'Search' ) . '" />';
$form .= '<input type="submit" class="adminbar-button" value="' . __('Search') . '"/>';
$form .= '</form>';
$form .= '</div>';
$wp_admin_bar->add_menu( array(
'id' => 'search',
'title' => $form,
'href' => '#',
'meta' => array(
'class' => 'admin-bar-search',
// @TODO: Replace me with something far less hacky
'onclick' => 'if ( event.target.value != "Search" ) { return false; }',
),
) );
}
/**
* Style and scripts for the admin bar.
*

View File

@ -97,13 +97,6 @@ class WP_Admin_Bar {
<?php endforeach; ?>
</ul>
</div>
<div id="adminbarsearch-wrap">
<form action="<?php echo home_url(); ?>" method="get" id="adminbarsearch">
<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />
<input type="submit" class="adminbar-button" value="<?php _e('Search'); ?>"/>
</form>
</div>
</div>
<?php
@ -183,15 +176,18 @@ class WP_Admin_Bar {
function add_menus() {
add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
add_action( 'admin_bar_menu', 'wp_admin_bar_dashboard_view_site_menu', 25 );
add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );
add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
if ( !is_network_admin() && !is_user_admin() ) {
if ( ! is_admin() ) {
add_action( 'admin_bar_menu', 'wp_admin_bar_blog_front_menu', 25 );
add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
add_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 );
add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 100 );
} else {
add_action( 'admin_bar_menu', 'wp_admin_bar_blog_admin_menu', 25 );
add_action( 'admin_bar_menu', 'wp_admin_bar_help_menu', 90 );
}
do_action( 'add_admin_bar_menus' );

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@
#wpadminbar a,
#wpadminbar a:hover,
#wpadminbar a img,
#wpadminbar a img,
#wpadminbar a img:hover {
outline: none;
border: none;
@ -70,7 +70,8 @@
border-right: none;
}
#wpadminbar .quicklinks > ul > li:hover > a {
#wpadminbar .quicklinks > ul > li:hover > a,
#wpadminbar .quicklinks > ul > li.selected > a {
border-left-color: #707070;
}
@ -159,7 +160,7 @@
#wpadminbar .quicklinks .menupop a > span {
display: inline;
background: url(../images/admin-bar-sprite.png?d=11122010) right -58px no-repeat;
background: url(../images/admin-bar-sprite.png?d=11122010) right -57px no-repeat;
padding-right: .8em;
}
@ -169,7 +170,6 @@
padding-right: 1.5em;
}
#wpadminbar .quicklinks a span#ab-awaiting-mod,
#wpadminbar .quicklinks a span#ab-updates {
background: #eee;
color: #333;
@ -184,97 +184,132 @@
border-radius: 10px;
}
#wpadminbar .quicklinks a:hover span#ab-awaiting-mod,
#wpadminbar .quicklinks a:hover span#ab-updates {
background: #fff;
color: #000;
}
#wpadminbar #wp-admin-bar-my-account,
#wpadminbar #wp-admin-bar-my-account-with-avatar {
float: right;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account > a {
border-left: none;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a {
border-left: none;
background: url(../images/admin-bar-sprite.png?d=11122010) top left no-repeat;
background: url(../images/admin-bar-sprite.png?d=11122010) top right no-repeat;
margin-right: -7px;
padding-right: 48px;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar > a img {
width: 16px;
height: 16px;
display: inline;
border: 1px solid #999;
vertical-align: middle;
margin: -2px 23px 0 -5px;
position: absolute;
right: 6px;
top: 5px;
padding: 0;
background: #eee;
float: none;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul {
left: 30px;
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul ul {
left: 0;
}
#wpadminbar .quicklinks li#wp-admin-bar-my-account-with-avatar ul ul {
left: 0;
}
#wpadminbar .quicklinks .menupop li a img.blavatar {
#wpadminbar .quicklinks li img.blavatar {
vertical-align: middle;
margin: 0 8px 0 0;
margin: -3px 4px 0 0;
padding: 0;
}
#wpadminbar #wp-admin-bar-search a {
padding: 0;
}
#wpadminbar .quicklinks .admin-bar-search:hover {
/* default background */
background: transparent;
}
#wpadminbar .quicklinks .admin-bar-search:hover > a {
/* default borders */
border-right: none;
border-left: 1px solid #808080;
}
#wpadminbar #adminbarsearch {
float: right;
height: 18px;
padding: 3px;
height: 26px;
padding: 2px 4px;
/* padding: 0;*/
margin: 0;
}
#wpadminbar #adminbarsearch .adminbar-input {
height: 23px;
width: 140px;
height: auto;
float: left;
font: 12px Arial, Helvetica, sans-serif;
color: #555;
text-shadow: 0 1px 0 #fff;
border: 1px solid #626262;
padding: 2px 3px;
font: 13px Arial, Helvetica, sans-serif;
border: none;
padding: 0 3px 0 24px;
margin: 0 3px 0 0;
background: #ddd;
-moz-box-shadow: inset 2px 2px 1px #cdcdcd;
-webkit-box-shadow: inset 2px 2px 1px #cdcdcd;
box-shadow: inset 2px 2px 1px #cdcdcd;
-webkit-border-radius: 0;
-khtml-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
color: #ddd;
text-shadow: #555 0px -1px 0px;
background-color: rgba( 255, 255, 255, 0 );
/* @todo: replace/move twenty eleven image to a core search icon. */
background-image: url('../../wp-content/themes/twentyeleven/images/search.png');
background-repeat: no-repeat;
background-position: 4px 2px;
-webkit-border-radius: 3px;
-khtml-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
outline: none;
-webkit-transition-duration: 400ms;
-webkit-transition-property: width, background;
-webkit-transition-timing-function: ease;
-moz-transition-duration: 400ms;
-moz-transition-property: width, background;
-moz-transition-timing-function: ease;
-o-transition-duration: 400ms;
-o-transition-property: width, background;
-o-transition-timing-function: ease;
}
#wpadminbar #adminbarsearch .adminbar-input:focus {
color: #555;
text-shadow: 0 1px 0 #fff;
width: 200px;
background-color: rgba( 255, 255, 255, 0.9 );
}
/* Two rules to ensure browser recognition */
#wpadminbar #adminbarsearch .adminbar-input::-webkit-input-placeholder {
color: #e4e4e4;
}
#wpadminbar #adminbarsearch .adminbar-input:-moz-placeholder {
color: #e4e4e4;
}
#wpadminbar #adminbarsearch .adminbar-button {
font: bold 12px Arial, Helvetica, sans-serif;
color: #444;
text-shadow: 0px 1px 0px #eee;
cursor: pointer;
float: left;
background: #aaa;
background: -moz-linear-gradient(bottom, #aaa, #cecece);
background: -webkit-gradient(linear, left bottom, left top, from(#aaa), to(#cecece));
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border: 1px solid #626262;
padding: 2px 13px;
margin: 0;
width: auto;
height: auto;
display: none;
}
#wpadminbar #adminbarsearch .adminbar-button:active {
@ -294,6 +329,46 @@
border: none;
}
/**
* Comments bubble
*/
#wpadminbar .ab-comments-bubble {
position: relative;
padding-top: 5px;
}
#wpadminbar .ab-comments-count {
background: #ddd;
color: #555;
text-shadow: none;
height: 1.2em;
line-height: 1.2em;
padding: 2px 8px 0;
font-size: 12px;
font-weight: bold;
-moz-border-radius: 10px;
-khtml-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
}
#wpadminbar a:hover .ab-comments-count {
background: #fff;
color: #333;
}
#wpadminbar a .ab-comments-arrow {
height: 0;
position: absolute;
bottom: -4px;
left: 6px;
/* Use transparent borders to form a triangle */
border-left: 5px solid #ddd;
border-bottom: 5px solid transparent;
}
#wpadminbar a:hover .ab-comments-arrow {
border-left-color: #fff;
}
/**
* IE 6-targeted rules

View File

@ -2848,4 +2848,25 @@ function parent_post_rel_link($title = '%title') {
_deprecated_function( __FUNCTION__, '3.3' );
echo get_parent_post_rel_link($title);
}
}
/**
* Add the "Dashboard"/"Visit Site" menu.
*
* @since 3.2.0
* @deprecated 3.3
*/
function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
_deprecated_function( __FUNCTION__, '3.3' );
$user_id = get_current_user_id();
if ( 0 != $user_id ) {
if ( is_admin() )
$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
elseif ( is_multisite() )
$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
else
$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
}
}

View File

@ -61,7 +61,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20101110' );
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20110913', 1 );
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20110915', 1 );
$scripts->add_script_data( 'common', 'commonL10n', array(
'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete.")
) );
@ -402,13 +402,13 @@ function wp_default_styles( &$styles ) {
// Any rtl stylesheets that don't have a .dev version for ltr
$no_suffix = array( 'farbtastic' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20110914c' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20110915' );
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array('wp-admin'), '20110902' );
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
// all colors stylesheets need to have the same query strings (cache manifest compat)
$colors_version = '20110914';
$colors_version = '20110915';
// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
$styles->add( 'colors', true, array('wp-admin'), $colors_version );
@ -423,7 +423,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1' );
$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20110622' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20110915' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101224' );
$styles->add( 'editor-buttons', "/wp-includes/css/editor-buttons$suffix.css", array(), '20110802' );