{% load reviews_tags %}
{% load i18n %}

<article class="review">
    <header>
        <h3 class="star {{ review.score|as_stars }}"><a href="{{ review.get_absolute_url }}">{{ review.title }} <span>{{ review.score }}</span></a></h3>
    </header>
    <div class="row-fluid">
        <div class="span8 review_content">
            <div>
                <p>{{ review.body.strip|linebreaks }}</p>
                <p>
                    <small>
                        {% blocktrans with name=review.get_reviewer_name review_date=review.date_created %}
                        Reviewed by {{ name }} on {{ review_date }}
                        {% endblocktrans %}
                        | <a href="{% url catalogue:reviews-detail product.slug product.pk review.pk %}">{% trans 'Permalink' %}</a>
                    </small>
                </p>
            </div>
        </div>
        <div class="span4 review_votes">
            <div>
                {% if request.user.is_authenticated %}
                    {% trans "Is this review helpful?" %}<br/>
                    <form action="{{ review.get_absolute_url }}" method="post" class="vote_agree" >
                        {% csrf_token %}
                        <input type="hidden" name="delta" value="1"/>
                        <button type="submit" class="btn btn-success btn-small">{% trans "Yes" %}</button>
                    </form>
                    <form  action="{{ review.get_absolute_url }}" method="post">
                        {% csrf_token %}
                        <input type="hidden" name="delta" value="-1"/>
                        <button type="submit" class="btn btn-danger btn-small">{% trans "No" %}</button>
                    </form>
                {% endif %}

                {% if review.has_votes %}
                    <p>
                        {% blocktrans count review.num_up_votes as num_up_votes %}
                        1 customer found this useful
                        {% plural %}
                        {{ num_up_votes }} customers found this useful
                        {% endblocktrans %}
                    </p>
                {% endif %}
            </div>
        </div>
    </div>
</article>
