Files
2026-hypn0-site/hypn0/templates/block/vote_button.html
T

23 lines
1.4 KiB
HTML

<div id="vote-btn-{{ item.s_hash_id }}" class="inline-flex items-center">
{% if not_agreed %}
<span class="text-amber-500 text-xs flex items-center gap-1 font-bold">
🐌 Подчинитесь воле Гипножабы!
</span>
{% else %}
<form hx-post="{% url 'hypn0_site:gallery_vote' item.s_hash_id %}"
hx-target="#vote-btn-{{ item.s_hash_id }}"
hx-swap="outerHTML"
class="inline-flex items-center">
{% csrf_token %}
<button type="submit"
{% if user_voted %}disabled{% endif %}
class="flex items-center gap-1.5 px-3.5 py-1.5 rounded-full text-xs font-bold transition-all {% if user_voted %}bg-rose-500/20 text-rose-400 border border-rose-500/30 cursor-default{% else %}bg-stone-200 dark:bg-stone-800 hover:bg-rose-500 hover:text-white text-stone-700 dark:text-stone-300 cursor-pointer hover:scale-105 active:scale-95 shadow-sm{% endif %}">
<svg class="w-4 h-4 {% if user_voted %}fill-rose-500 text-rose-500{% else %}fill-none stroke-current{% endif %}" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
</svg>
<span>{{ item.i_likes_count }}</span>
</button>
</form>
{% endif %}
</div>