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() { } }