Skip to content

Commit

Permalink
Half star styling and number formatting corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
merwhite11 committed Sep 16, 2024
1 parent 711afbd commit 2be674b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions openlibrary/macros/SearchResultsWork.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@
</span>

<div class="details">
<h3 itemprop="name">
<div class="resultTitle">
<h3 itemprop="name" class="booktitle">
<a itemprop="url" href="$work_edition_url" class="results">$full_title</a>
</h3>
<span class="resultAuthor" itemprop="author" itemscope itemtype="https://schema.org/Organization" class="bookauthor">
</div>
<span itemprop="author" itemscope itemtype="https://schema.org/Organization" class="bookauthor">
$ authors = None
$if doc_type == 'infogami_work':
$ authors = doc.get_authors()
Expand Down
6 changes: 3 additions & 3 deletions openlibrary/macros/StarRatingsByline.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
$def with(ratings_count, ratings_average, want_to_read_count)

$ formatted_want_to_read_count = "{:,}".format(want_to_read_count)
$ formatted_want_to_read_count = "{:,}".format(want_to_read_count) if want_to_read_count else ""
$ ratings_label = _('rating') if ratings_count == 1 else _('ratings')

<span class="ratingsByline itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
$if ratings_count:
$:macros.StarRatingsComponent(ratings_count, ratings_average, 'results_page')
</span>
$if want_to_read_count > 0 and ratings_count > 0:
$if want_to_read_count and ratings_count:
<span class="dot">·</span>
$if want_to_read_count > 0:
$if want_to_read_count:
<span class="ratingsByline" itemprop="reviewCount">$_('%(want_to_read_count)s Want to read', want_to_read_count=formatted_want_to_read_count)</span>
2 changes: 1 addition & 1 deletion openlibrary/macros/StarRatingsComponent.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$def with(ratings_count, ratings_average, page_type)

$ rounded_avg = "%.1f" % ratings_average
$ formatted_ratings_count = "{:,}".format(ratings_count)
$ formatted_ratings_count = "{:,}".format(ratings_count) if ratings_count else ""
$ ratings_label = _('rating') if ratings_count == 1 else _('ratings')
$ star_class = 'readers-stats__star' if page_type == 'book_page' else 'readers-stats__star--byline'
$ half_star_class = 'readers-stats__star--half' if page_type == 'book_page' else 'readers-stats__star--byline-half'
Expand Down
2 changes: 1 addition & 1 deletion static/css/components/readerStats.less
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
font-size: 1.5em;
}
&__star--half {
color: @gold;
margin: 0 0 0 -5px;
font-size: 1.5em;
background: linear-gradient(90deg, @gold 50%, @light-grey 50%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
Expand Down
2 changes: 1 addition & 1 deletion static/css/components/search-result-item.less
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
margin: 0;
}

span.resultStats {
.resultStats {
font-size: .75em;
color: @grey;
font-family: @lucida_sans_serif-6;
Expand Down

0 comments on commit 2be674b

Please sign in to comment.