From 1e98c517298f263d09a68d5a5e1629f936c163b8 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Tue, 1 Mar 2022 21:21:02 +0100 Subject: [PATCH] Add report and delete icons --- .../lightgallery/plugins/admin/lg-admin.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/photologue/static/lightgallery/plugins/admin/lg-admin.js b/photologue/static/lightgallery/plugins/admin/lg-admin.js index 53b0f4f..890c983 100644 --- a/photologue/static/lightgallery/plugins/admin/lg-admin.js +++ b/photologue/static/lightgallery/plugins/admin/lg-admin.js @@ -13,16 +13,29 @@ class lgAdmin { } init() { - this.core.$toolbar.append("\uE033"); + const adminIcon = ""; + const deleteIcon = "";; + const reportIcon = ""; + + // Add button linking to Django admin page + this.core.$toolbar.append(`${adminIcon}`); + document.getElementById("lg-admin").style.display = this.isStaff ? 'block' : 'none'; + + // Add button to delete photo + this.core.$toolbar.append(`${deleteIcon}`); + document.getElementById("lg-delete").style.display = this.isStaff ? 'block' : 'none'; + + // Add button to report photo + this.core.$toolbar.append(`${reportIcon}`); + this.core.LGel.on("lgAfterSlide.admin", this.onAfterSlide.bind(this)); } 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 + // Plugins must have destroy prototype destroy() { } }