From 695ec94d7cc66d2194b0cb45ed41ad78afd88b4f Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 1 Mar 2022 21:06:58 +0100 Subject: [PATCH] Always load lg-admin plugin --- photologue/static/lightgallery/plugins/admin/lg-admin.js | 2 ++ photologue/templates/photologue/gallery_detail.html | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/photologue/static/lightgallery/plugins/admin/lg-admin.js b/photologue/static/lightgallery/plugins/admin/lg-admin.js index 64ba238..53b0f4f 100644 --- a/photologue/static/lightgallery/plugins/admin/lg-admin.js +++ b/photologue/static/lightgallery/plugins/admin/lg-admin.js @@ -8,6 +8,7 @@ class lgAdmin { constructor(instance, $LG) { this.core = instance; this.$LG = $LG; + this.isStaff = instance.settings.isStaff; return this; } @@ -19,6 +20,7 @@ class lgAdmin { onAfterSlide(event) { const photoId = this.core.galleryItems[event.detail.index].slideName; document.getElementById("lg-admin").href = `https://photos.crans.org/admin/photologue/photo/${photoId}/change/`; + document.getElementById("lg-admin").style.display = this.isStaff ? 'block' : 'none'; } // Admin must have destroy prototype diff --git a/photologue/templates/photologue/gallery_detail.html b/photologue/templates/photologue/gallery_detail.html index 4975d54..3561932 100644 --- a/photologue/templates/photologue/gallery_detail.html +++ b/photologue/templates/photologue/gallery_detail.html @@ -20,8 +20,9 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endblock %}