From 72e93441023ed81c11af113112fc5d024e6d5274 Mon Sep 17 00:00:00 2001 From: krek0 Date: Mon, 11 May 2026 14:24:35 +0200 Subject: [PATCH] Fix gallery photo deletion gap and uncensor UI glitche. --- photologue/locale/fr/LC_MESSAGES/django.po | 4 ++++ photologue/static/gallery_justified.js | 1 + .../static/lightgallery/plugins/admin/lg-admin.js | 9 ++++++++- .../templates/photologue/gallery_detail.html | 14 +++++++++++++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/photologue/locale/fr/LC_MESSAGES/django.po b/photologue/locale/fr/LC_MESSAGES/django.po index b60677f..2ac7b65 100644 --- a/photologue/locale/fr/LC_MESSAGES/django.po +++ b/photologue/locale/fr/LC_MESSAGES/django.po @@ -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 "" diff --git a/photologue/static/gallery_justified.js b/photologue/static/gallery_justified.js index 80dcc55..e162011 100644 --- a/photologue/static/gallery_justified.js +++ b/photologue/static/gallery_justified.js @@ -70,6 +70,7 @@ }); } + window.applyJustifiedLayout = applyLayout; document.addEventListener('DOMContentLoaded', applyLayout); window.addEventListener('resize', applyLayout); })(); diff --git a/photologue/static/lightgallery/plugins/admin/lg-admin.js b/photologue/static/lightgallery/plugins/admin/lg-admin.js index aa0214d..0c44cc4 100644 --- a/photologue/static/lightgallery/plugins/admin/lg-admin.js +++ b/photologue/static/lightgallery/plugins/admin/lg-admin.js @@ -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(); diff --git a/photologue/templates/photologue/gallery_detail.html b/photologue/templates/photologue/gallery_detail.html index 5364548..402e0c1 100755 --- a/photologue/templates/photologue/gallery_detail.html +++ b/photologue/templates/photologue/gallery_detail.html @@ -44,7 +44,19 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endif %} {% if gallery.date_start %}

{{ gallery.date_start }}{% if gallery.date_end and gallery.date_end != gallery.date_start %} {% trans "to" %} {{ gallery.date_end }}{% endif %}

{% endif %} -{% if request.user.is_staff and gallery.photo_private_count %}

{{ gallery.photo_private_count }} photos censurées

{% endif %} +{% if request.user.is_staff and gallery.photo_private_count %}

{{ gallery.photo_private_count }} {% trans "censored photos" %}

{% endif %} +{% if request.user.is_staff %} + {% if public_url %} + + {% else %} +
{% csrf_token %}
+ {% endif %} +{% endif %} {% if gallery.tags.all %}

Tags : {% for tag in gallery.tags.all %}