61e7290ce8
Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
2.5 KiB
HTML
51 lines
2.5 KiB
HTML
{% if photos %}
|
|
<div class="gallery">
|
|
{% for photo in photos %}
|
|
<article class="photo-card" data-id="{{ photo.id }}">
|
|
<div class="photo-card__image-wrap">
|
|
<img
|
|
src="{{ photo.url }}"
|
|
alt="{{ photo.original_name }}"
|
|
class="photo-card__image"
|
|
loading="lazy"
|
|
>
|
|
<div class="photo-card__overlay">
|
|
<button type="button" class="btn btn--ghost btn--sm copy-btn" data-url="{{ request.url_root.rstrip('/') }}{{ photo.url }}">
|
|
Копировать ссылку
|
|
</button>
|
|
<a href="{{ photo.url }}" target="_blank" class="btn btn--ghost btn--sm">Открыть</a>
|
|
</div>
|
|
</div>
|
|
<div class="photo-card__info">
|
|
<span class="photo-card__name" title="{{ photo.original_name }}">{{ photo.original_name }}</span>
|
|
<div class="photo-card__meta">
|
|
<span>{{ photo.size_human }}</span>
|
|
<span>{{ photo.created_at.strftime('%d.%m.%Y %H:%M') }}</span>
|
|
</div>
|
|
{% if show_owner and photo.owner %}
|
|
<div class="photo-card__owner">@{{ photo.owner.username }}</div>
|
|
{% endif %}
|
|
{% if delete_mode == 'admin' %}
|
|
<form action="{{ url_for('admin.delete_photo', photo_id=photo.id) }}" method="post" class="photo-card__delete" onsubmit="return confirm('Удалить это фото?');">
|
|
<button type="submit" class="btn btn--danger btn--sm">Удалить</button>
|
|
</form>
|
|
{% elif current_user.is_authenticated and (current_user.is_admin or photo.user_id == current_user.id) %}
|
|
<form action="{{ url_for('main.delete_photo', photo_id=photo.id) }}" method="post" class="photo-card__delete" onsubmit="return confirm('Удалить это фото?');">
|
|
<button type="submit" class="btn btn--danger btn--sm">Удалить</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</article>
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<div class="empty-state">
|
|
<div class="empty-state__icon">🖼️</div>
|
|
<h3>{{ empty_title or 'Пока нет фотографий' }}</h3>
|
|
<p>{{ empty_text or 'Загрузите первое изображение — оно появится здесь' }}</p>
|
|
{% if empty_link %}
|
|
<a href="{{ empty_link }}" class="btn btn--primary">{{ empty_link_text or 'Загрузить фото' }}</a>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|