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.
Built from https://develop.svn.wordpress.org/trunk@35006


git-svn-id: http://core.svn.wordpress.org/trunk@34971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-10-10 06:51:24 +00:00
parent 24219160f1
commit ac9a85a45e
7 changed files with 31 additions and 100 deletions

View File

@ -1154,57 +1154,23 @@ body.show-upload-theme p.no-themes {
}
}
.theme-details .theme-rating {
line-height: 23px;
}
.theme-details .star-rating {
margin: 15px 0 0;
display: inline;
}
.theme-details .star-rating span:before {
color: #ffb900;
content: "\f154";
display: inline-block;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 dashicons;
vertical-align: top;
.theme-details .num-ratings,
.theme-details .no-rating {
font-size: 11px;
color: #999;
}
/* Half stars */
.star-rating.rating-10 span.one:before,
.star-rating.rating-30 span.two:before,
.star-rating.rating-50 span.three:before,
.star-rating.rating-70 span.four:before,
.star-rating.rating-90 span.five:before {
content: "\f459";
}
/* Full stars */
.star-rating.rating-20 span.one:before,
.star-rating.rating-30 span.one:before,
.star-rating.rating-40 span.one:before,
.star-rating.rating-40 span.two:before,
.star-rating.rating-50 span.one:before,
.star-rating.rating-50 span.two:before,
.star-rating.rating-60 span.one:before,
.star-rating.rating-60 span.two:before,
.star-rating.rating-60 span.three:before,
.star-rating.rating-70 span.one:before,
.star-rating.rating-70 span.two:before,
.star-rating.rating-70 span.three:before,
.star-rating.rating-80 span.one:before,
.star-rating.rating-80 span.two:before,
.star-rating.rating-80 span.three:before,
.star-rating.rating-80 span.four:before,
.star-rating.rating-90 span.one:before,
.star-rating.rating-90 span.two:before,
.star-rating.rating-90 span.three:before,
.star-rating.rating-90 span.four:before,
.star-rating.rating-100 > span:before {
content: "\f155";
}
.theme-details .star-rating .ratings {
.theme-details .no-rating {
display: block;
line-height: 20px;
color: #999;
}
/*------------------------------------------------------------------------------
@ -1628,7 +1594,7 @@ body.full-overlay-active {
}
.install-theme-info .theme-screenshot {
margin-top: 15px;
margin: 15px 0;
width: 258px;
border: 1px solid #ccc;
}

View File

@ -1154,57 +1154,23 @@ body.show-upload-theme p.no-themes {
}
}
.theme-details .theme-rating {
line-height: 23px;
}
.theme-details .star-rating {
margin: 15px 0 0;
display: inline;
}
.theme-details .star-rating span:before {
color: #ffb900;
content: "\f154";
display: inline-block;
-webkit-font-smoothing: antialiased;
font: normal 20px/1 dashicons;
vertical-align: top;
.theme-details .num-ratings,
.theme-details .no-rating {
font-size: 11px;
color: #999;
}
/* Half stars */
.star-rating.rating-10 span.one:before,
.star-rating.rating-30 span.two:before,
.star-rating.rating-50 span.three:before,
.star-rating.rating-70 span.four:before,
.star-rating.rating-90 span.five:before {
content: "\f459";
}
/* Full stars */
.star-rating.rating-20 span.one:before,
.star-rating.rating-30 span.one:before,
.star-rating.rating-40 span.one:before,
.star-rating.rating-40 span.two:before,
.star-rating.rating-50 span.one:before,
.star-rating.rating-50 span.two:before,
.star-rating.rating-60 span.one:before,
.star-rating.rating-60 span.two:before,
.star-rating.rating-60 span.three:before,
.star-rating.rating-70 span.one:before,
.star-rating.rating-70 span.two:before,
.star-rating.rating-70 span.three:before,
.star-rating.rating-80 span.one:before,
.star-rating.rating-80 span.two:before,
.star-rating.rating-80 span.three:before,
.star-rating.rating-80 span.four:before,
.star-rating.rating-90 span.one:before,
.star-rating.rating-90 span.two:before,
.star-rating.rating-90 span.three:before,
.star-rating.rating-90 span.four:before,
.star-rating.rating-100 > span:before {
content: "\f155";
}
.theme-details .star-rating .ratings {
.theme-details .no-rating {
display: block;
line-height: 20px;
color: #999;
}
/*------------------------------------------------------------------------------
@ -1628,7 +1594,7 @@ body.full-overlay-active {
}
.install-theme-info .theme-screenshot {
margin-top: 15px;
margin: 15px 0;
width: 258px;
border: 1px solid #ccc;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2801,7 +2801,8 @@ function wp_ajax_query_themes() {
$theme->author = wp_kses( $theme->author, $themes_allowedtags );
$theme->version = wp_kses( $theme->version, $themes_allowedtags );
$theme->description = wp_kses( $theme->description, $themes_allowedtags );
$theme->num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme->num_ratings ), number_format_i18n( $theme->num_ratings ) );
$theme->stars = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false ) );
$theme->num_ratings = number_format_i18n( $theme->num_ratings );
$theme->preview_url = set_url_scheme( $theme->preview_url );
}

View File

@ -242,14 +242,12 @@ if ( $tab ) {
<div class="theme-details">
<# if ( data.rating ) { #>
<div class="star-rating rating-{{ Math.round( data.rating / 10 ) * 10 }}">
<span class="one"></span><span class="two"></span><span class="three"></span><span class="four"></span><span class="five"></span>
<small class="ratings">{{ data.num_ratings }}</small>
<div class="theme-rating">
{{{ data.stars }}}
<span class="num-ratings">({{ data.num_ratings }})</span>
</div>
<# } else { #>
<div class="star-rating">
<small class="ratings"><?php _e( 'This theme has not been rated yet.' ); ?></small>
</div>
<span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
<# } #>
<div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div>
<div class="theme-description">{{{ data.description }}}</div>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-35005';
$wp_version = '4.4-alpha-35006';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.