From 31c1b29b8fafdb4e9388e23f3273f41a03eaea4a Mon Sep 17 00:00:00 2001
From: Arne Schauf <git@asw.io>
Date: Mon, 19 Mar 2018 01:52:50 +0100
Subject: make tags editable

---
 src/pages/UploadDetail.vue | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

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

diff --git a/src/pages/UploadDetail.vue b/src/pages/UploadDetail.vue
index 7cf19a3..800fefa 100644
--- a/src/pages/UploadDetail.vue
+++ b/src/pages/UploadDetail.vue
@@ -69,11 +69,36 @@
           </div>
         </q-card-main>
         <q-card-separator />
-        <q-card-title><i class="far fa-hand-point-right"></i> Tags</q-card-title>
+        <q-card-title>
+          <i class="far fa-hand-point-right"></i> Tags
+          <q-btn outline
+                 round
+                 v-if="editTags"
+                 @click="saveUpload()"
+                 color="positive"
+                 size="sm"
+                 icon="fa-save" />
+          <q-btn outline
+                 round
+                 v-if="editTags"
+                 @click="editTags = false; refresh()"
+                 size="sm"
+                 color="negative"
+                 icon="fa-times" />
+          <q-btn outline
+                 round
+                 v-if="!editTags"
+                 @click="editTags = true"
+                 size="sm"
+                 icon="fa-edit" />
+        </q-card-title>
         <q-card-main>
-          <div class="group">
+          <div v-if="!editTags" class="group">
             <q-chip v-for="tag of upload.tags" :key="tag">{{ tag }}</q-chip>
           </div>
+          <q-chips-input v-model="upload.tags"
+                         v-else
+                         float-label="Tags" />
         </q-card-main>
         <q-card-separator />
         <q-card-title><i class="far fa-hand-point-right"></i> Comments</q-card-title>
@@ -232,6 +257,7 @@
         comment: '',
         commentSaving: false,
         editDescription: false,
+        editTags: false,
       }
     },
     methods: {
@@ -262,6 +288,7 @@
         let that = this
         this.$http.put(`/uploads/${this.upload._id}`, this.upload).then(response => {
           that.editDescription = false
+          that.editTags = false
           that.refresh()
         }).catch(() => that.$q.notify('Failed to save mod'))
       },
-- 
cgit v1.2.3-54-g00ecf

