aboutsummaryrefslogtreecommitdiff
path: root/resources/assets/javascripts/bootstrap/files.js
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-03-22 11:56:11 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2023-03-22 11:56:11 +0000
commit3dcee65137d7c25129c93a2f197084e2e9c8ab2f (patch)
tree00bab06ca06cda301075c10b9b095c58ea808a1a /resources/assets/javascripts/bootstrap/files.js
parent2ba898859c58b7538f51a257c281a70d42452390 (diff)
use event bus to toggle display of gallery link and make sure the gallery link...
Closes #2409 Merge request studip/studip!1604
Diffstat (limited to 'resources/assets/javascripts/bootstrap/files.js')
-rw-r--r--resources/assets/javascripts/bootstrap/files.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/resources/assets/javascripts/bootstrap/files.js b/resources/assets/javascripts/bootstrap/files.js
index 72a2a6e..6caef6d 100644
--- a/resources/assets/javascripts/bootstrap/files.js
+++ b/resources/assets/javascripts/bootstrap/files.js
@@ -17,6 +17,10 @@ function searchMoreFiles (button) {
return false;
}
+STUDIP.eventBus.on('files-vue-app-updated', ({hasImages}) => {
+ $('#sidebar-actions a[onclick*="Files.openGallery"]').toggle(hasImages);
+});
+
STUDIP.domReady(() => {
STUDIP.Files.init();
@@ -49,11 +53,6 @@ STUDIP.domReady(() => {
});
});
-$(document).on('files-vue-app-loaded', () => {
- const lightboxImages = $('.lightbox-image');
- $('#sidebar-actions a[onclick*="Files.openGallery"]').attr('disabled', lightboxImages.length === 0);
-});
-
jQuery(document).on('ajaxComplete', (event, xhr) => {
if (!xhr.getResponseHeader('X-Filesystem-Changes')) {
return;