moviewyrm/bookwyrm/templates/snippets/fav_button.html
2021-08-23 13:15:35 -07:00

35 lines
1.2 KiB
HTML

{% load interaction %}
{% load utilities %}
{% load i18n %}
{% with status.id|uuid as uuid %}
{% with request.user|liked:status as liked %}
<form
name="favorite"
action="{% url 'fav' status.id %}"
method="POST"
class="interaction fav_{{ status.id }}_{{ uuid }} {% if liked %}is-hidden{% endif %}"
data-id="fav_{{ status.id }}_{{ uuid }}"
>
{% csrf_token %}
<button class="button is-small is-light is-transparent" type="submit">
<span class="icon icon-heart m-0-mobile" title="{% trans 'Like' %}"></span>
<span class="is-sr-only-mobile">{% trans "Like" %}</span>
</button>
</form>
<form
name="unfavorite"
action="{% url 'unfav' status.id %}"
method="POST"
class="interaction fav_{{ status.id }}_{{ uuid }} active {% if not liked %}is-hidden{% endif %}"
data-id="fav_{{ status.id }}_{{ uuid }}"
>
{% csrf_token %}
<button class="button is-light is-transparent is-small" type="submit">
<span class="icon icon-heart has-text-primary m-0-mobile" title="{% trans 'Un-like' %}"></span>
<span class="is-sr-only-mobile">{% trans "Un-like" %}</span>
</button>
</form>
{% endwith %}
{% endwith %}