From b6068b17c4e87ae8c20b39d38caddd66a944faf7 Mon Sep 17 00:00:00 2001
From: Henrique Dias <hacdias@gmail.com>
Date: Tue, 4 Jul 2017 17:25:16 +0100
Subject: [PATCH] Use computed instead of methods

Former-commit-id: f12061f2b024f046c5e23d40607f2e6814a8fe7d [formerly 5d6e0b8669f70e000e0c06a5a0ac26f8e1304996] [formerly bccb50f7402b88efa2e548c310f2c28349583167 [formerly c9522aa526b0a1f24f64f69a3fec78164ce96c0f]]
Former-commit-id: c21c41181c7bfdfc22fcd7327e4487ea45789220 [formerly 09d8cd5d1a2ba59f0954297c0f5516bf8a5e67b4]
Former-commit-id: dcbe1f78bdc393275263a0af534cbbbf934e578d
---
 _assets/src/components/Main.vue | 82 ++++++++++++++++-----------------
 1 file changed, 41 insertions(+), 41 deletions(-)

diff --git a/_assets/src/components/Main.vue b/_assets/src/components/Main.vue
index 526c46f8..cf0a8597 100644
--- a/_assets/src/components/Main.vue
+++ b/_assets/src/components/Main.vue
@@ -12,12 +12,12 @@
         <button @click="openSearch" aria-label="Search" title="Search" class="search-button action">
           <i class="material-icons">search</i>
         </button>
-        <rename-button v-show="!loading && showRenameButton()"></rename-button>
-        <move-button v-show="!loading && showMoveButton()"></move-button>
-        <delete-button v-show="!loading && showDeleteButton()"></delete-button>
+        <rename-button v-show="!loading && showRenameButton"></rename-button>
+        <move-button v-show="!loading && showMoveButton"></move-button>
+        <delete-button v-show="!loading && showDeleteButton"></delete-button>
         <switch-button v-show="!loading && req.kind !== 'editor'"></switch-button>
         <download-button></download-button>
-        <upload-button v-show="!loading && showUpload()"></upload-button>
+        <upload-button v-show="!loading && showUpload"></upload-button>
         <info-button></info-button>
 
         <button v-show="isListing" @click="$store.commit('multiple', true)" aria-label="Select multiple" class="action">
@@ -120,6 +120,43 @@ export default {
     },
     isEditor () {
       return this.req.kind === 'editor' && !this.loading
+    },
+    showUpload () {
+      if (this.req.kind === 'editor') return false
+      return this.user.allowNew
+    },
+    showDeleteButton () {
+      if (this.req.kind === 'listing') {
+        if (this.selectedCount === 0) {
+          return false
+        }
+
+        return this.user.allowEdit
+      }
+
+      return this.user.allowEdit
+    },
+    showRenameButton () {
+      if (this.req.kind === 'listing') {
+        if (this.selectedCount === 1) {
+          return this.user.allowEdit
+        }
+
+        return false
+      }
+
+      return this.user.allowEdit
+    },
+    showMoveButton () {
+      if (this.req.kind !== 'listing') {
+        return false
+      }
+
+      if (this.selectedCount > 0) {
+        return this.user.allowEdit
+      }
+
+      return false
     }
   },
   data: function () {
@@ -232,43 +269,6 @@ export default {
     },
     openSearch () {
       this.$store.commit('showHover', 'search')
-    },
-    showUpload: function () {
-      if (this.req.kind === 'editor') return false
-      return this.user.allowNew
-    },
-    showDeleteButton: function () {
-      if (this.req.kind === 'listing') {
-        if (this.selectedCount === 0) {
-          return false
-        }
-
-        return this.user.allowEdit
-      }
-
-      return this.user.allowEdit
-    },
-    showRenameButton: function () {
-      if (this.req.kind === 'listing') {
-        if (this.selectedCount === 1) {
-          return this.user.allowEdit
-        }
-
-        return false
-      }
-
-      return this.user.allowEdit
-    },
-    showMoveButton: function () {
-      if (this.req.kind !== 'listing') {
-        return false
-      }
-
-      if (this.selectedCount > 0) {
-        return this.user.allowEdit
-      }
-
-      return false
     }
   }
 }