Skip to content

Commit

Permalink
Show "Not yet rated" instead of "0 reviews"; bug 568117
Browse files Browse the repository at this point in the history
  • Loading branch information
clouserw committed May 26, 2010
1 parent 7fcb0ac commit 4893c5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/reviews/templates/reviews/reviews_link.html
Expand Up @@ -6,11 +6,15 @@
<p class="addon-rating">
{{ addon.bayesian_rating|stars }}
{% with num=addon.total_reviews %}
{% if num %}
<a href="{{ base }}">
{% with count='<span itemprop="count">{0}</span>'|f(num|numberfmt) %}
{# Using num=count so we don't change an L10n string. #}
<strong>{{ ngettext('{num} review', '{num} reviews',
num)|f(num=count)|safe }}</strong></a>
{% endwith %}
{% else %}
<strong>{{ _('Not yet rated') }}</strong>
{% endif %}
{% endwith %}
</p>
4 changes: 4 additions & 0 deletions apps/reviews/tests/test_helpers.py
Expand Up @@ -40,3 +40,7 @@ def test_reviews_link():
'myuuid': myuuid})
eq_(PyQuery(s)('a').attr('href'),
'/addon/1/?collection_uuid=%s#reviews' % myuuid)

z = Addon(average_rating=0, total_reviews=0, id=1)
s = render('{{ myaddon|reviews_link }}', {'myaddon': z})
eq_(PyQuery(s)('strong').text(), 'Not yet rated')

0 comments on commit 4893c5b

Please sign in to comment.