From cad1cc3fda42c04c4dbfda6831dd01b846756fbb Mon Sep 17 00:00:00 2001
From: Fulgen301 <tokmajigeorge@gmail.com>
Date: Fri, 26 Jul 2019 17:16:50 +0200
Subject: Add file deletion confirmation dialog

---
 src/pages/UploadDetail.vue | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

(limited to 'src/pages/UploadDetail.vue')

diff --git a/src/pages/UploadDetail.vue b/src/pages/UploadDetail.vue
index 194abf4..c37f9dd 100644
--- a/src/pages/UploadDetail.vue
+++ b/src/pages/UploadDetail.vue
@@ -239,7 +239,7 @@
                    size="sm"
                    icon="fa-trash"
                    color="negative"
-                   @click="upload.files.splice(idx, 1)"/>
+                   @click="deleteFile(fid)" />
           </div>
           <div v-if="editFiles">
             <dropzone id="filesDropzone"
@@ -378,6 +378,21 @@
           cancel: 'Cancel',
         }).then(() => that.$http.delete(`/uploads/${upload.id}`).then(response => that.refresh()))
       },
+      deleteFile (file) {
+        let that = this
+        this.$q.dialog({
+          title: 'Delete mod?',
+          message: `Do you really want to delete the file "${file.name}"? This cannot be undone!`,
+          ok: {
+            label: 'Yes, delete!',
+            icon: 'fa-trash',
+            color: 'negative',
+            outline: true,
+          },
+          cancel: 'Cancel',
+        }).then(() => that.$http.delete(`/media/${file.id}`).then(response => that.refresh()))
+      },
+
       downloadMedia (mediaId, filename, done) {
         window.open(`${this.$http.defaults.baseURL}/media/${mediaId}?download=1`)
         /*
-- 
cgit v1.2.3-54-g00ecf

