init commit
This commit is contained in:
17
templates/ui/components/like_button.html
Normal file
17
templates/ui/components/like_button.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{# expects: profile_id, liked: bool #}
|
||||
<form method="post"
|
||||
hx-post="{% url 'like_profile' profile_id %}"
|
||||
hx-target="this"
|
||||
hx-swap="outerHTML"
|
||||
aria-label="Добавить в избранное">
|
||||
{% csrf_token %}
|
||||
{% if liked %}
|
||||
<button type="submit" class="inline-flex items-center gap-1 rounded-md border px-3 py-1.5 text-sm hover:bg-white">
|
||||
<span aria-hidden="true">❤️</span> В избранном
|
||||
</button>
|
||||
{% else %}
|
||||
<button type="submit" class="inline-flex items-center gap-1 rounded-md border px-3 py-1.5 text-sm hover:bg-white">
|
||||
<span aria-hidden="true">🤍</span> В избранное
|
||||
</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
3
templates/ui/components/like_button_login_required.html
Normal file
3
templates/ui/components/like_button_login_required.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<a href="/login/?next={{ request.path }}" class="inline-flex items-center gap-1 rounded-md bg-indigo-600 text-white px-3 py-1.5 text-sm hover:bg-indigo-700">
|
||||
Войти, чтобы добавить
|
||||
</a>
|
||||
27
templates/ui/components/profile_card.html
Normal file
27
templates/ui/components/profile_card.html
Normal file
@@ -0,0 +1,27 @@
|
||||
{# expects: profile, liked_ids (optional) #}
|
||||
{% with liked = (profile.liked|default_if_none:False) or (liked_ids and profile.id in liked_ids) %}
|
||||
<article class="rounded-xl bg-white/80 backdrop-blur border shadow-sm hover:shadow transition overflow-hidden flex flex-col">
|
||||
<img src="{{ profile.photo }}" alt="Фото {{ profile.name }}" class="w-full h-56 object-cover">
|
||||
<div class="p-4 flex-1 flex flex-col">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<h3 class="text-lg font-semibold">{{ profile.name }}, {{ profile.age }}</h3>
|
||||
{% if profile.verified %}
|
||||
<span class="inline-flex items-center text-[10px] rounded-full bg-emerald-100 text-emerald-800 px-2 py-0.5">проверено</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if profile.city %}<p class="text-sm text-gray-600 mt-1">{{ profile.city }}</p>{% endif %}
|
||||
{% if profile.about %}<p class="text-sm mt-3 line-clamp-2">{{ profile.about }}</p>{% endif %}
|
||||
{% if profile.interests %}
|
||||
<div class="mt-3 flex flex-wrap gap-2">
|
||||
{% for tag in profile.interests %}
|
||||
<span class="inline-flex items-center text-xs rounded-full bg-gray-100 px-2 py-1">{{ tag }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="mt-4 flex items-center justify-between">
|
||||
<a class="text-sm font-medium text-indigo-700 hover:underline" href="/profiles/{{ profile.id }}/">Подробнее</a>
|
||||
{% include 'ui/components/like_button.html' with profile_id=profile.id liked=liked %}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
{% endwith %}
|
||||
Reference in New Issue
Block a user