{% load reviews_tags %}
{% load i18n %}
{% if product.rating != None %}
    <p class="star-rating {{ product.rating|as_stars }}">
        <i class="fas fa-star"></i>
        <i class="fas fa-star"></i>
        <i class="fas fa-star"></i>
        <i class="fas fa-star"></i>
        <i class="fas fa-star"></i>
        <small>
        <a href="{% url 'catalogue:reviews-list' product_slug=product.slug product_pk=product.id %}">
            {% blocktrans count product.num_approved_reviews as num_reviews %}
                {{ num_reviews }} customer review
                {% plural %}
                {{ num_reviews }} customer reviews
            {% endblocktrans %}
        </a>
        </small>
        &nbsp;
    {% else %}
        <p>
        {% endif %}
        {% if product|is_review_permitted:user %}
            <a id="write_review"
               href="{% url 'catalogue:reviews-add' product_slug=product.slug product_pk=product.id %}#addreview"
               class="btn btn-success btn-sm">
                {% trans "Write a review" %}
            </a>
        {% endif %}
    </p>
