Make WordPress Core

Ticket #32152: 32152.diff

File 32152.diff, 4.3 KB (added by picard102, 11 years ago)

Comment Count Badge Design

  • wp-admin/css/list-tables.css

     
    44}
    55
    66.post-com-count {
     7        float: left;
    78        background: none;
    89        height: 1.3em;
    910        line-height: 1.1em;
    10         display: block;
    1111        text-decoration: none;
    1212        padding: 0 0 6px;
    13         cursor: pointer;
    14         background-position: center -80px;
    15         background-repeat: no-repeat;
    1613        color: #fff;
     14        text-align: center;
     15        position: relative;
     16        margin-top: 5px;
    1717}
    1818
    19 .post-com-count:after {         /* draw bubble connector using CSS! */
     19.post-com-count:after {
    2020        content: "";
    2121        display: block;
    2222        width: 0;
    2323        height: 0;
    2424        margin-left: 8px;
    25         border-top: 5px solid #b4b9be;
     25        border-top: 5px solid #767676;
    2626        border-right: 5px solid transparent;
    2727}
    2828
    29 .post-com-count span {
     29.post-com-count .comment-count {
    3030        font-size: 11px;
    3131        font-weight: 600;
    32         height: 1.4em;
    33         line-height: 1.4em;
    34         min-width: 0.7em;
    35         padding: 0 6px;
    36         display: inline-block;
     32        /* the following are calculated on the font size
     33           and need 8 decimals to avoid different roundings in different browsers */
     34        height: 1.95454545em;
     35        line-height: 1.96363636;
     36        min-width: 0.72727272em;
     37        padding: 0 8px;
     38        display: block;
    3739        -webkit-border-radius: 5px;
    3840        border-radius: 5px;
    39         background-color: #b4b9be;
     41        background-color: #767676;
    4042        color: #fff;
     43        overflow: hidden;
    4144}
    4245
    43 .post-com-count:hover {
    44         background-position: center -3px;
    45 }
    4646
    47 .post-com-count:hover span {
    48         background-color: #00a0d2;
     47.has-pending .post-com-count .comment-count-pending {
     48        display: block;
     49        background: #d54e21;
     50        font-size: 9px;
     51        font-weight: 600;
     52        /* the following are calculated on the font size
     53           and need 8 decimals to avoid different roundings in different browsers */
     54        height: 1.75454545em;
     55        line-height: 1.76363636;
     56        min-width: 0.2727272em;
     57        padding: 0 5px;
     58        -webkit-border-radius: 10px;
     59        border-radius: 10px;
     60        color: #fff;
     61        overflow: hidden;
     62        position: absolute;
     63        top: -4px;
     64        left: 85%;
     65        border: 2px solid #fff;
    4966}
    5067
    51 .post-com-count:hover:after {
    52         border-top: 5px solid #00a0d2;
    53 }
    5468
    55 strong .post-com-count {
    56         background-position: center -55px;
    57 }
    58 
    59 strong .post-com-count span {
    60         background-color: #0073aa;
    61 }
    62 
    63 strong .post-com-count:after {
    64         border-top: 5px solid #0073aa;
    65 }
    66 
    6769.column-response .post-com-count {
    6870        float: left;
    6971        margin-right: 5px;
  • wp-admin/includes/class-wp-list-table.php

     
    612612         * @param int $pending_comments Number of pending comments.
    613613         */
    614614        protected function comments_bubble( $post_id, $pending_comments ) {
    615                 $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
     615                $approved_comments_number = number_format_i18n( get_comments_number() );
     616                $pending_comments_number = number_format( $pending_comments );
     617                $count_phrase = sprintf( __( '%s approved and %s pending comments' ), $approved_comments_number, $pending_comments_number );
    616618
    617                 if ( $pending_comments )
    618                         echo '<strong>';
     619                if ( $pending_comments ) {
     620                        echo '<strong class="has-pending">';
     621                }
    619622
    620                 echo "<a href='" . esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . number_format_i18n( get_comments_number() ) . "</span></a>";
     623                // don't output a link if no comments
     624                if ( ! $approved_comments_number && ! $pending_comments_number ) {
     625                        printf( '<span class="post-com-count"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
     626                                $approved_comments_number,
     627                                $count_phrase
     628                        );
     629                } else {
     630                        printf( '<a href="%s" aria-label="%s" class="post-com-count"><span class="comment-count">%s</span><span class="comment-count-pending">%s</span></a>',
     631                                esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ),
     632                                esc_attr( $count_phrase ),
     633                                $approved_comments_number,
     634                                $pending_comments_number
     635                        );
     636                }
    621637
    622                 if ( $pending_comments )
     638                if ( $pending_comments ) {
    623639                        echo '</strong>';
     640                }
    624641        }
    625642
    626643        /**