diff --git a/photologue_custom/static/lightgallery/plugins/admin/lg-admin.js b/photologue_custom/static/lightgallery/plugins/admin/lg-admin.js new file mode 100644 index 0000000..64ba238 --- /dev/null +++ b/photologue_custom/static/lightgallery/plugins/admin/lg-admin.js @@ -0,0 +1,26 @@ +/* + * Custom LightGallery plugin to add some buttons for administration + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +class lgAdmin { + constructor(instance, $LG) { + this.core = instance; + this.$LG = $LG; + return this; + } + + init() { + this.core.$toolbar.append("\uE033"); + 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/`; + } + + // Admin must have destroy prototype + destroy() { } +} diff --git a/photologue_custom/templates/photologue/gallery_detail.html b/photologue_custom/templates/photologue/gallery_detail.html index fd7b1f4..dcbb43b 100644 --- a/photologue_custom/templates/photologue/gallery_detail.html +++ b/photologue_custom/templates/photologue/gallery_detail.html @@ -14,12 +14,13 @@ SPDX-License-Identifier: GPL-3.0-or-later {% block extrajs %} + @@ -68,7 +69,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% for photo in photos %} - + {{ photo.title }}{% if photo.date_taken %} - {{ photo.date_taken|date }} {{ photo.date_taken|time }}{% endif %} - {{ photo.extended.owner.get_full_name }}{% if photo.extended.license %} - {{ photo.extended.license }}{% endif %} {% endfor %}