From d94dd33286fd2a203a52f8ef838d5ef663ad9f55 Mon Sep 17 00:00:00 2001
From: Thomas Hackl <hackl@data-quest.de>
Date: Mon, 13 Sep 2021 11:58:41 +0000
Subject: [PATCH] =?UTF-8?q?Arbeitsplatz/Dateiansicht:=20=C3=9Cbersichtssei?=
 =?UTF-8?q?te=20fehlen=20Ansichten?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 resources/assets/javascripts/lib/files.js |  4 ++--
 resources/vue/components/FilesTable.vue   | 24 ++++++++++++-----------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/resources/assets/javascripts/lib/files.js b/resources/assets/javascripts/lib/files.js
index 59ae95f52e1..716219e9a35 100644
--- a/resources/assets/javascripts/lib/files.js
+++ b/resources/assets/javascripts/lib/files.js
@@ -39,7 +39,7 @@ const Files = {
         //tables are displayed in one page.
         var tables = jQuery('.vue-file-table');
         if (tables.length) {
-            for (var table of tables) {
+            for (let table of tables) {
                 STUDIP.Vue.load().then(({createApp}) => {
                     createApp({
                         el: table,
@@ -342,4 +342,4 @@ const Files = {
     }
 };
 
-export default Files;
\ No newline at end of file
+export default Files;
diff --git a/resources/vue/components/FilesTable.vue b/resources/vue/components/FilesTable.vue
index 76d0be6a0dd..44605013b2a 100644
--- a/resources/vue/components/FilesTable.vue
+++ b/resources/vue/components/FilesTable.vue
@@ -369,19 +369,21 @@ export default {
     watch: {
         selectedIds (current) {
             const activated = current.length > 0;
-            this.$nextTick(() => { // needs to be wrapped since we check the dom
-                this.$refs.buttons.querySelectorAll('.multibuttons .button').forEach(element => {
-                    let condition = element.dataset.activatesCondition;
-                    if (!condition || !activated) {
-                        element.disabled = !activated;
-                    } else {
-                        condition = condition.replace(/:has\((.*?)\)/g, ' $1');
-                        condition = condition.replace(':checkbox', 'input[type="checkbox"]');
+            if (this.$refs.buttons) {
+                this.$nextTick(() => { // needs to be wrapped since we check the dom
+                    this.$refs.buttons.querySelectorAll('.multibuttons .button').forEach(element => {
+                        let condition = element.dataset.activatesCondition;
+                        if (!condition || !activated) {
+                            element.disabled = !activated;
+                        } else {
+                            condition = condition.replace(/:has\((.*?)\)/g, ' $1');
+                            condition = condition.replace(':checkbox', 'input[type="checkbox"]');
 
-                        element.disabled = this.$el.querySelector(condition) === null;
-                    }
+                            element.disabled = this.$el.querySelector(condition) === null;
+                        }
+                    });
                 });
-            });
+            }
         },
     }
 }
-- 
GitLab