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/static/lightgallery/plugins/hash/lg-hash.min.js b/photologue_custom/static/lightgallery/plugins/hash/lg-hash.min.js new file mode 100644 index 0000000..54e927e --- /dev/null +++ b/photologue_custom/static/lightgallery/plugins/hash/lg-hash.min.js @@ -0,0 +1,8 @@ +/** + * lightgallery | 2.2.1 | September 4th 2021 + * http://www.lightgalleryjs.com/ + * Copyright (c) 2020 Sachin Neravath; + * @license GPLv3 + */ + + !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).lgHash=e()}(this,(function(){"use strict";var t=function(){return(t=Object.assign||function(t){for(var e,i=1,o=arguments.length;i0){this.$LG(document.body).addClass("lg-from-hash");var e=this.getIndexFromUrl(t);return this.core.openGallery(e),!0}},s.prototype.onCloseAfter=function(){this.oldHash&&this.oldHash.indexOf("lg="+this.settings.galleryId)<0?history.replaceState?history.replaceState(null,"",this.oldHash):window.location.hash=this.oldHash:history.replaceState?history.replaceState(null,document.title,window.location.pathname+window.location.search):window.location.hash=""},s.prototype.onHashchange=function(){if(this.core.lgOpened){var t=window.location.hash,e=this.getIndexFromUrl(t);t.indexOf("lg="+this.settings.galleryId)>-1?this.core.slide(e,!1,!1):this.core.lGalleryOn&&this.core.closeGallery()}},s.prototype.closeGallery=function(){this.settings.hash&&this.$LG(document.body).removeClass("lg-from-hash")},s.prototype.destroy=function(){this.core.LGel.off(".lg.hash"),this.core.LGel.off(".hash"),this.$LG(window).off("hashchange.lg.hash.global"+this.core.lgId)},s}()})); diff --git a/photologue_custom/templates/photologue/gallery_detail.html b/photologue_custom/templates/photologue/gallery_detail.html index 7fac587..dcbb43b 100644 --- a/photologue_custom/templates/photologue/gallery_detail.html +++ b/photologue_custom/templates/photologue/gallery_detail.html @@ -14,11 +14,14 @@ SPDX-License-Identifier: GPL-3.0-or-later {% block extrajs %} + + {% endblock %} @@ -66,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 %}