Make WordPress Core

Ticket #22059: responsive-admin-bar.patch

File responsive-admin-bar.patch, 5.6 KB (added by JoN1oP, 11 years ago)

Responsive Adminbar

  • wp-includes/admin-bar.php

     
    231231        if ( $title != $blogname )
    232232                $title = trim( $title ) . '…';
    233233
     234    $title = '<span class="ab-icon"></span><span class="ab-label">'.$title.'</span>';
     235
    234236        $wp_admin_bar->add_menu( array(
    235237                'id'    => 'site-name',
    236238                'title' => $title,
     
    287289        if ( count( $wp_admin_bar->user->blogs ) < 1 && ! is_super_admin() )
    288290                return;
    289291
     292    $title = '<span class="ab-icon"></span><span class="ab-label">' . _x( 'My Sites', 'admin bar menu group label' ) . '</span>';
     293
    290294        $wp_admin_bar->add_menu( array(
    291295                'id'    => 'my-sites',
    292                 'title' => __( 'My Sites' ),
     296                'title' => $title,
    293297                'href'  => admin_url( 'my-sites.php' ),
    294298        ) );
    295299
     
    369373                        $wp_admin_bar->add_menu( array(
    370374                                'parent' => $menu_id,
    371375                                'id'     => $menu_id . '-n',
    372                                 'title'  => __( 'New Post' ),
     376                                'title'  => __( 'New Post' ), 
    373377                                'href'   => admin_url( 'post-new.php' ),
    374378                        ) );
    375379                        $wp_admin_bar->add_menu( array(
     
    421425function wp_admin_bar_edit_menu( $wp_admin_bar ) {
    422426        global $tag, $wp_the_query;
    423427
     428    $html_before = '<span class="ab-icon"></span><span class="ab-label">';
     429        $html_after = '</span>';
     430
    424431        if ( is_admin() ) {
    425432                $current_screen = get_current_screen();
    426433                $post = get_post();
    427 
     434               
    428435                if ( 'post' == $current_screen->base
    429436                        && 'add' != $current_screen->action
    430437                        && ( $post_type_object = get_post_type_object( $post->post_type ) )
     
    434441                {
    435442                        $wp_admin_bar->add_menu( array(
    436443                                'id' => 'view',
    437                                 'title' => $post_type_object->labels->view_item,
     444                                'title' => $html_before . $post_type_object->labels->view_item . $html_after,
    438445                                'href' => get_permalink( $post->ID )
    439446                        ) );
    440447                } elseif ( 'edit-tags' == $current_screen->base
     
    444451                {
    445452                        $wp_admin_bar->add_menu( array(
    446453                                'id' => 'view',
    447                                 'title' => $tax->labels->view_item,
     454                                'title' => $html_before . $tax->labels->view_item . $html_after,
    448455                                'href' => get_term_link( $tag )
    449456                        ) );
    450457                }
     
    461468                {
    462469                        $wp_admin_bar->add_menu( array(
    463470                                'id' => 'edit',
    464                                 'title' => $post_type_object->labels->edit_item,
     471                                'title' => $html_before . $post_type_object->labels->edit_item . $html_after,
    465472                                'href' => get_edit_post_link( $current_object->ID )
    466473                        ) );
    467474                } elseif ( ! empty( $current_object->taxonomy )
     
    471478                {
    472479                        $wp_admin_bar->add_menu( array(
    473480                                'id' => 'edit',
    474                                 'title' => $tax->labels->edit_item,
     481                                'title' => $html_before . $tax->labels->edit_item . $html_after,
    475482                                'href' => get_edit_term_link( $current_object->term_id, $current_object->taxonomy )
    476483                        ) );
    477484                }
  • wp-includes/css/admin-bar.css

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    642642* html #wpadminbar .menupop a span {
    643643        background-image: none;
    644644}
     645
     646/**
     647 * Response admin bar
     648 */
     649 
     650#wp-admin-bar-my-sites .ab-icon,
     651#wp-admin-bar-site-name .ab-icon,
     652#wp-admin-bar-edit .ab-icon,
     653#wp-admin-bar-view .ab-icon {
     654    display:none;
     655}
     656
     657@media (max-width: 900px) {
     658   
     659     #wpadminbar {
     660         min-width: 600px;
     661     }
     662     
     663     #wp-admin-bar-new-content .ab-label,
     664     #wp-admin-bar-search   {
     665         display: none;
     666     }
     667     
     668     #wp-admin-bar-my-account>.ab-item,
     669     #wp-admin-bar-my-sites>.ab-item,
     670     #wp-admin-bar-site-name>.ab-item,
     671     #wp-admin-bar-edit>.ab-item,
     672     #wp-admin-bar-view>.ab-item {
     673         font-size: 0;
     674         overflow:hidden;
     675     }
     676     
     677     /* user + avatar */
     678     #wp-admin-bar-my-account .ab-item {
     679         padding-left:6px !important;
     680     }
     681     
     682     #wp-admin-bar-edit>.ab-item,
     683     #wp-admin-bar-view>.ab-item,
     684     #wp-admin-bar-my-sites>.ab-item,
     685     #wp-admin-bar-site-name>.ab-item {
     686         padding: 0 10px !important;
     687         width: 20px;
     688     }
     689     
     690     /* my sites */
     691     #wp-admin-bar-my-sites .ab-item .ab-icon {
     692          display:block;
     693          background-image: url(../images/admin-bar-sprite.png?d=20120830);
     694          background-position:-1px -263px;
     695          background-repeat: no-repeat;
     696     }
     697     #wp-admin-bar-my-sites .ab-item:hover .ab-icon,
     698     #wp-admin-bar-my-sites.hover .ab-item .ab-icon {
     699          background-position:-1px -283px;
     700     }
     701     
     702     /* site name */
     703     #wp-admin-bar-site-name .ab-item .ab-icon {
     704          display: block;
     705          background-image: url(../images/admin-bar-sprite.png?d=20120830);
     706          background-position: -1px -223px;
     707          background-repeat: no-repeat;
     708      }
     709      #wp-admin-bar-site-name .ab-item:hover .ab-icon,
     710      #wp-admin-bar-site-name.hover .ab-item .ab-icon {
     711          background-position: -1px -243px;
     712      }
     713     
     714     /* edit post */
     715      #wp-admin-bar-edit .ab-item .ab-icon {
     716           display: block;
     717           background-image: url(../images/admin-bar-sprite.png?d=20120830);
     718           background-position: -1px -303px;
     719           background-repeat: no-repeat;
     720       }
     721     /* view post */
     722     #wp-admin-bar-view .ab-item .ab-icon {
     723            display: block;
     724            background-image: url(../images/admin-bar-sprite.png?d=20120830);
     725            background-position: -1px -303px;
     726            background-repeat: no-repeat;
     727    }
     728
     729}
     730 No newline at end of file