Fix gallery photo deletion gap and uncensor UI glitche.

This commit is contained in:
krek0 2026-05-11 14:24:35 +02:00
parent ed28d4a9c4
commit 72e9344102
4 changed files with 26 additions and 2 deletions

View file

@ -399,6 +399,10 @@ msgstr "Aucune galerie trouvée."
msgid "to"
msgstr "au"
#: photologue/templates/photologue/gallery_detail.html:49
msgid "censored photos"
msgstr "photos censurées"
#: photologue/templates/photologue/gallery_detail.html:53
msgid "Public link:"
msgstr ""

View file

@ -70,6 +70,7 @@
});
}
window.applyJustifiedLayout = applyLayout;
document.addEventListener('DOMContentLoaded', applyLayout);
window.addEventListener('resize', applyLayout);
})();

View file

@ -76,9 +76,15 @@ class lgAdmin {
if (el) {
el.dataset.isPublic = 'true';
const img = el.querySelector('img');
if (img) img.classList.remove('border-danger', 'border-5');
if (img) img.classList.remove('border-danger', 'border-5', 'photo-private');
}
document.getElementById("lg-restore").style.display = 'none';
const countSpan = document.getElementById('private-count');
if (countSpan) {
const newCount = parseInt(countSpan.textContent, 10) - 1;
if (newCount <= 0) document.getElementById('private-count-line').remove();
else countSpan.textContent = newCount;
}
});
}
}
@ -101,6 +107,7 @@ class lgAdmin {
this.core.LGel.off('lgAfterSlide.adminRemove');
const thumb = document.querySelector(`[data-slide-name='${photoId}']`);
if (thumb) thumb.remove();
if (typeof window.applyJustifiedLayout === 'function') window.applyJustifiedLayout();
const lgId = this.core.lgId;
const deletedItem = document.getElementById(`lg-item-${lgId}-${currentIndex}`);
if (deletedItem) deletedItem.remove();

View file

@ -44,7 +44,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% endif %}
</h1>
{% if gallery.date_start %}<p class="text-muted small">{{ gallery.date_start }}{% if gallery.date_end and gallery.date_end != gallery.date_start %} {% trans "to" %} {{ gallery.date_end }}{% endif %}</p>{% endif %}
{% if request.user.is_staff and gallery.photo_private_count %}<p class="text-danger small">{{ gallery.photo_private_count }} photos censurées</p>{% endif %}
{% if request.user.is_staff and gallery.photo_private_count %}<p class="text-danger small" id="private-count-line"><span id="private-count">{{ gallery.photo_private_count }}</span> {% trans "censored photos" %}</p>{% endif %}
{% if request.user.is_staff %}
{% if public_url %}
<div class="alert alert-secondary py-1 d-flex align-items-center gap-2 small" role="alert">
<span>{% trans "Public link:" %}</span>
<input type="text" class="form-control form-control-sm" id="public-link-input" value="{{ public_url }}" readonly style="max-width:400px">
<button class="btn btn-outline-secondary btn-sm" data-clipboard-text="{{ public_url }}">{% trans "Copy" %}</button>
<form method="post" action="{% url 'photologue:pl-gallery-token' gallery.slug %}" class="mb-0">{% csrf_token %}<input type="hidden" name="action" value="revoke"><button type="submit" class="btn btn-outline-danger btn-sm">{% trans "Revoke" %}</button></form>
</div>
{% else %}
<form method="post" action="{% url 'photologue:pl-gallery-token' gallery.slug %}" class="mb-2">{% csrf_token %}<input type="hidden" name="action" value="generate"><button type="submit" class="btn btn-outline-primary btn-sm">{% trans "Generate public link" %}</button></form>
{% endif %}
{% endif %}
{% if gallery.tags.all %}
<p class="text-muted">
Tags : {% for tag in gallery.tags.all %}