lib.itmens/journal/templates/action_like_post.html
2024-05-20 12:00:17 -04:00

21 lines
677 B
HTML

{% load i18n %}
{% load user_actions %}
{% liked_post post as liked %}
<span hx-target="this"
hx-swap="outerHTML"
{% if not request.user.is_authenticated %}hx-disable{% endif %}>
{% if liked %}
<a class="activated"
hx-post="{% url 'journal:post_unlike' post.pk %}"
title="{% trans "liked" %}">
<i class="fa-solid fa-heart }}"></i>
<span>{{ post.stats.likes }}</span>
</a>
{% else %}
<a hx-post="{% url 'journal:post_like' post.pk %}"
title="{% trans "like" %}">
<i class="fa-regular fa-heart }}"></i>
{% if post.stats.likes %}<span>{{ post.stats.likes }}</span>{% endif %}
</a>
{% endif %}
</span>