lib.itmens/journal/templates/action_like_post.html
2023-12-29 22:27:28 -05:00

19 lines
632 B
HTML

{% 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="已喜欢">
<i class="fa-solid fa-heart }}"></i>
<span>{{ post.stats.likes }}</span>
</a>
{% else %}
<a hx-post="{% url 'journal:post_like' post.pk %}" title="喜欢">
<i class="fa-regular fa-heart }}"></i>
{% if post.stats.likes %}<span>{{ post.stats.likes }}</span>{% endif %}
</a>
{% endif %}
</span>