Make WordPress Core

Changeset 35006


Ignore:
Timestamp:
10/10/2015 06:50:35 AM (11 years ago)
Author:
SergeyBiryukov
Message:

Use wp_star_rating() on Add Themes screen:

  • It works correctly for RTL
  • Requires less CSS styling
  • Is visually consistent with plugin ratings
  • Is more accessible

Fixes #34080.

Location:
trunk/src/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/themes.css

    r34365 r35006  
    11551155}
    11561156
     1157.theme-details .theme-rating {
     1158        line-height: 23px;
     1159}
     1160
    11571161.theme-details .star-rating {
    1158         margin: 15px 0 0;
    1159 }
    1160 
    1161 .theme-details .star-rating span:before {
    1162         color: #ffb900;
    1163         content: "\f154";
    1164         display: inline-block;
    1165         -webkit-font-smoothing: antialiased;
    1166         font: normal 20px/1 dashicons;
    1167         vertical-align: top;
    1168 }
    1169 
    1170 /* Half stars */
    1171 .star-rating.rating-10 span.one:before,
    1172 .star-rating.rating-30 span.two:before,
    1173 .star-rating.rating-50 span.three:before,
    1174 .star-rating.rating-70 span.four:before,
    1175 .star-rating.rating-90 span.five:before {
    1176         content: "\f459";
    1177 }
    1178 
    1179 /* Full stars */
    1180 .star-rating.rating-20 span.one:before,
    1181 .star-rating.rating-30 span.one:before,
    1182 .star-rating.rating-40 span.one:before,
    1183 .star-rating.rating-40 span.two:before,
    1184 .star-rating.rating-50 span.one:before,
    1185 .star-rating.rating-50 span.two:before,
    1186 .star-rating.rating-60 span.one:before,
    1187 .star-rating.rating-60 span.two:before,
    1188 .star-rating.rating-60 span.three:before,
    1189 .star-rating.rating-70 span.one:before,
    1190 .star-rating.rating-70 span.two:before,
    1191 .star-rating.rating-70 span.three:before,
    1192 .star-rating.rating-80 span.one:before,
    1193 .star-rating.rating-80 span.two:before,
    1194 .star-rating.rating-80 span.three:before,
    1195 .star-rating.rating-80 span.four:before,
    1196 .star-rating.rating-90 span.one:before,
    1197 .star-rating.rating-90 span.two:before,
    1198 .star-rating.rating-90 span.three:before,
    1199 .star-rating.rating-90 span.four:before,
    1200 .star-rating.rating-100 > span:before {
    1201         content: "\f155";
    1202 }
    1203 
    1204 .theme-details .star-rating .ratings {
     1162        display: inline;
     1163}
     1164
     1165.theme-details .num-ratings,
     1166.theme-details .no-rating {
     1167        font-size: 11px;
     1168        color: #999;
     1169}
     1170
     1171.theme-details .no-rating {
    12051172        display: block;
    12061173        line-height: 20px;
    1207         color: #999;
    12081174}
    12091175
     
    16291595
    16301596.install-theme-info .theme-screenshot {
    1631         margin-top: 15px;
     1597        margin: 15px 0;
    16321598        width: 258px;
    16331599        border: 1px solid #ccc;
  • trunk/src/wp-admin/includes/ajax-actions.php

    r34912 r35006  
    28022802                $theme->version     = wp_kses( $theme->version, $themes_allowedtags );
    28032803                $theme->description = wp_kses( $theme->description, $themes_allowedtags );
    2804                 $theme->num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme->num_ratings ), number_format_i18n( $theme->num_ratings ) );
     2804                $theme->stars       = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false ) );
     2805                $theme->num_ratings = number_format_i18n( $theme->num_ratings );
    28052806                $theme->preview_url = set_url_scheme( $theme->preview_url );
    28062807        }
  • trunk/src/wp-admin/theme-install.php

    r34891 r35006  
    243243                                <div class="theme-details">
    244244                                        <# if ( data.rating ) { #>
    245                                                 <div class="star-rating rating-{{ Math.round( data.rating / 10 ) * 10 }}">
    246                                                         <span class="one"></span><span class="two"></span><span class="three"></span><span class="four"></span><span class="five"></span>
    247                                                         <small class="ratings">{{ data.num_ratings }}</small>
     245                                                <div class="theme-rating">
     246                                                        {{{ data.stars }}}
     247                                                        <span class="num-ratings">({{ data.num_ratings }})</span>
    248248                                                </div>
    249249                                        <# } else { #>
    250                                                 <div class="star-rating">
    251                                                         <small class="ratings"><?php _e( 'This theme has not been rated yet.' ); ?></small>
    252                                                 </div>
     250                                                <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
    253251                                        <# } #>
    254252                                        <div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div>
Note: See TracChangeset for help on using the changeset viewer.