Make WordPress Core

Ticket #32152: 32152.5.diff

File 32152.5.diff, 11.0 KB (added by picard102, 11 years ago)

Removed zero count to be more consistent with how it's displayed elsewhere. Fixed some alignment bugs.

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

     
    1 /* List table styles */
    2 .post-com-count-wrapper {
    3         min-width: 22px;
    4 }
    51
    6 .post-com-count {
    7         background: none;
    8         height: 1.3em;
    9         line-height: 1.1em;
     2.response-links {
    103        display: block;
    11         text-decoration: none;
    12         padding: 0 0 6px;
    13         cursor: pointer;
    14         background-position: center -80px;
    15         background-repeat: no-repeat;
    16         color: #fff;
     4        margin-bottom: 12px;
    175}
    186
    19 .post-com-count:after {         /* draw bubble connector using CSS! */
    20         content: "";
     7.response-links a {
    218        display: block;
    22         width: 0;
    23         height: 0;
    24         margin-left: 8px;
    25         border-top: 5px solid #b4b9be;
    26         border-right: 5px solid transparent;
    279}
    2810
    29 .post-com-count span {
    30         font-size: 11px;
     11.response-links a.comments-edit-item-link {
    3112        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;
    37         -webkit-border-radius: 5px;
    38         border-radius: 5px;
    39         background-color: #b4b9be;
    40         color: #fff;
    4113}
    4214
    43 .post-com-count:hover {
    44         background-position: center -3px;
     15.response-links a.comments-view-item-link {
     16        font-size: 12px;
    4517}
    4618
    47 .post-com-count:hover span {
    48         background-color: #00a0d2;
     19.column-response .post-com-count .screen-reader-text {
     20        position: static;
     21        width: auto;
     22        height: auto;
     23        margin: 0;
    4924}
    5025
    51 .post-com-count:hover:after {
    52         border-top: 5px solid #00a0d2;
     26.column-response .post-com-count [aria-hidden="true"] {
     27        display: none;
    5328}
    5429
    55 strong .post-com-count {
    56         background-position: center -55px;
     30.column-response .post-com-count-wrapper strong {
     31        font-weight: 400;
    5732}
    5833
    59 strong .post-com-count span {
    60         background-color: #0073aa;
     34.column-response .post-com-count.post-com-count-pending {
     35        color: #bf461d;
    6136}
    6237
    63 strong .post-com-count:after {
    64         border-top: 5px solid #0073aa;
     38.post-com-count {
     39        display: block;
    6540}
    6641
    67 .column-response .post-com-count {
    68         float: left;
    69         margin-right: 5px;
    70         text-align: center;
     42.fixed .column-comments {
     43        width: 14em;
    7144}
    7245
    73 .response-links {
    74         float: left;
     46.comments-view-item-link {
     47        display: inline-block;
     48        clear: both;
    7549}
    7650
     51.ie8 .post-com-count .screen-reader-text {
     52        position: static;
     53        width: auto;
     54        height: auto;
     55        margin: 0;
     56}
     57
     58.ie8 .post-com-count [aria-hidden="true"] {
     59        display: none;
     60}
     61
     62.ie8 .post-com-count-wrapper strong {
     63        font-weight: 400;
     64}
     65
     66.ie8 .post-com-count.post-com-count-pending {
     67        color: #bf461d;
     68}
     69
     70@media screen and ( max-width: 782px ) {
     71        .post-com-count .screen-reader-text {
     72                position: static;
     73                width: auto;
     74                height: auto;
     75                margin: 0;
     76        }
     77
     78        .post-com-count [aria-hidden="true"] {
     79                display: none;
     80        }
     81
     82        .post-com-count-wrapper strong {
     83                font-weight: 400;
     84        }
     85
     86        .column-comments .post-com-count.post-com-count-pending {
     87                color: #bf461d;
     88        }
     89}
     90
     91@media screen and ( min-width: 782px ) {
     92        .fixed .column-comments {
     93                width: 4em;
     94        }
     95
     96        /* List table styles */
     97        .column-comments .post-com-count-wrapper,
     98        .column-comments .post-com-count-wrapper .has-pending   {
     99                float: left;
     100        }
     101
     102        .column-comments .post-com-count {
     103                float: right;
     104                background: none;
     105                text-decoration: none;
     106                color: #fff;
     107                margin-top: 5px;
     108        }
     109
     110        .column-comments .post-com-count-no-comments:after,
     111        .column-comments .post-com-count-approved:after {
     112                content: "";
     113                display: block;
     114                width: 0;
     115                height: 0;
     116                margin-left: 8px;
     117                border-top: 5px solid #72777c;
     118                border-right: 5px solid transparent;
     119        }
     120
     121        .column-comments .comment-count-pending {
     122                display: none;
     123        }
     124
     125        .column-comments .comment-count-no-comments,
     126        .column-comments .comment-count-approved,
     127        .column-comments .has-pending .comment-count-pending {
     128                display: block;
     129                font-weight: 400;
     130                vertical-align: top;
     131                overflow: hidden;
     132                -webkit-box-sizing: border-box;
     133                -moz-box-sizing: border-box;
     134                box-sizing: border-box;
     135        }
     136
     137        .column-comments .comment-count-no-comments,
     138        .column-comments .comment-count-approved {
     139                min-width: 24px;
     140                height: 2em;
     141                padding: 0 8px;
     142                line-height: 1.90909090; /*  1.92857142 */
     143                font-size: 11px;
     144                text-align: center;
     145                background-color: #72777c;
     146                color: #fff;
     147                -webkit-border-radius: 5px;
     148                border-radius: 5px;
     149        }
     150
     151        .column-comments .has-pending .comment-count-pending {
     152                position: relative;
     153                top: -4px;
     154                left: -3px;
     155                min-width: 21px;
     156                height: 21px;
     157                border: 2px solid #fff;
     158                padding: 0 5px;
     159                line-height: 17px;
     160                font-size: 9px;
     161                font-weight: 400;
     162                text-align: center;
     163                background: #ca4a1f;
     164                color: #fff;
     165                -webkit-border-radius: 50%;
     166                border-radius: 50%;
     167        }
     168
     169        .column-comments .post-com-count-pending:focus {
     170                outline: none;
     171                -webkit-box-shadow: none;
     172                box-shadow: none;
     173        }
     174
     175        .column-comments .post-com-count-approved:hover .comment-count-approved,
     176        .column-comments .post-com-count-approved:focus .comment-count-approved {
     177                background: #0073aa;
     178        }
     179
     180        .column-comments .post-com-count-approved:hover:after,
     181        .column-comments .post-com-count-approved:focus:after {
     182                border-top-color: #0073aa;
     183        }
     184
     185        .column-comments .post-com-count-pending:hover .comment-count-pending,
     186        .column-comments .post-com-count-pending:focus .comment-count-pending {
     187                -webkit-box-shadow:
     188                        0 0 0 1px #5b9dd9,
     189                        0 1px 2px 1px rgba(30, 140, 190, .8);
     190                box-shadow:
     191                        0 0 0 1px #5b9dd9,
     192                        0 1px 2px 1px rgba(30, 140, 190, .8);
     193        }
     194}
     195
    77196/* comments */
    78197
    79198.commentlist li {
     
    283402}
    284403
    285404.fixed .column-comments {
    286         width: 4em;
    287405        padding: 8px 0;
    288406        text-align: left;
    289407}
     
    292410        padding-left: 3px;
    293411}
    294412
    295 .fixed .column-comments a {
    296         float: left;
    297 }
    298413
    299414td.column-title strong,
    300415td.plugin-title strong {
  • wp-admin/includes/class-wp-comments-list-table.php

     
    678678                }
    679679
    680680                if ( current_user_can( 'edit_post', $post->ID ) ) {
    681                         $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
     681                        $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "' class='comments-edit-item-link'>";
    682682                        $post_link .= esc_html( get_the_title( $post->ID ) ) . '</a>';
    683683                } else {
    684684                        $post_link = esc_html( get_the_title( $post->ID ) );
    685685                }
    686686
    687                 echo '<div class="response-links"><span class="post-com-count-wrapper">';
    688                 echo $post_link . '<br />';
     687                echo '<div class="response-links">';
     688                echo $post_link;
     689                $post_type_object = get_post_type_object( $post->post_type );
     690                echo "<a href='" . get_permalink( $post->ID ) . "' class='comments-view-item-link'>" . $post_type_object->labels->view_item . '</a>';
     691                        if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
     692                echo $thumb;
     693                echo '</div>';
     694                echo '<span class="post-com-count-wrapper">';
    689695                $this->comments_bubble( $post->ID, $pending_comments );
    690696                echo '</span> ';
    691                 $post_type_object = get_post_type_object( $post->post_type );
    692                 echo "<a href='" . get_permalink( $post->ID ) . "'>" . $post_type_object->labels->view_item . '</a>';
    693                 echo '</div>';
    694                 if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
    695                         echo $thumb;
     697
     698
     699
    696700        }
    697701
    698702        /**
  • wp-admin/includes/class-wp-list-table.php

     
    1313        /**
    1414         * The current list of items
    1515         *
    16          * @since 3.1.0
     16         * @since 3.1.0 
    1717         * @var array
    1818         * @access public
    1919         */
     
    614614         * @param int $pending_comments Number of pending comments.
    615615         */
    616616        protected function comments_bubble( $post_id, $pending_comments ) {
    617                 $pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
     617                $approved_comments = get_comments_number();
     618                $approved_comments_number = number_format_i18n( $approved_comments );
     619                $pending_comments_number = number_format_i18n( $pending_comments );
     620                $total_phrase = sprintf( _n( '%s comment', '%s comments', $approved_comments ), $approved_comments_number );
     621                $approved_phrase = sprintf( _n( '%s approved comment', '%s approved comments', $approved_comments ), $approved_comments_number );
     622                $pending_phrase = sprintf( _n( '%s pending comment', '%s pending comments', $pending_comments ), $pending_comments_number );
    618623
    619                 if ( $pending_comments )
    620                         echo '<strong>';
     624                if ( $pending_comments ) {
     625                        echo '<strong class="has-pending">';
     626                }
     627               
     628                if ($approved_comments_number < 1 && $pending_comments > 0) {
     629               $no_comments_output = sprintf( '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
     630                        $approved_comments_number,
     631                        $pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
     632              );
     633                } else {
     634                        $no_comments_output = sprintf( '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
     635                        $pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
     636                        );
     637                }
    621638
    622                 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>";
     639                $total_comments_output = sprintf( '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
     640                        esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'approved' ), admin_url( 'edit-comments.php' ) ) ),
     641                        $approved_comments_number,
     642                        $total_phrase
     643                );
    623644
    624                 if ( $pending_comments )
     645                $approved_comments_output = sprintf( '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
     646                        esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'approved' ), admin_url( 'edit-comments.php' ) ) ),
     647                        $approved_comments_number,
     648                        $approved_phrase
     649                );
     650
     651                $pending_comments_output = sprintf( '<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
     652                        esc_url( add_query_arg( array( 'p' => $post_id, 'comment_status' => 'moderated' ), admin_url( 'edit-comments.php' ) ) ),
     653                        $pending_comments_number,
     654                        $pending_phrase
     655                );
     656
     657                if ( $pending_comments_number ) {
     658                        echo $pending_comments_output;
     659                }
     660
     661                if ( $approved_comments_number &&  $pending_comments ) {
     662
     663                        echo $approved_comments_output;
     664
     665                } elseif ( $approved_comments_number ) {
     666
     667                        echo $total_comments_output;
     668
     669                } else {
     670                        echo $no_comments_output;
     671                }
     672
     673                if ( $pending_comments ) {
    625674                        echo '</strong>';
     675                }
    626676        }
    627677
    628678        /**