Always load lg-admin plugin
This commit is contained in:
parent
6376e3b550
commit
695ec94d7c
2 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<script src="{% static 'lightgallery/plugins/zoom/lg-zoom.min.js' %}"></script>
|
||||
<script>
|
||||
lightGallery(document.getElementById('lightgallery'), {
|
||||
plugins: [{% if request.user.is_staff %}lgAdmin, {% endif %}lgHash, lgThumbnail, lgZoom],
|
||||
plugins: [lgAdmin, lgHash, lgThumbnail, lgZoom],
|
||||
customSlideName: true,
|
||||
isStaff: {{ request.user.is_staff|yesno:"true,false" }},
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue