Use computed instead of methods
Former-commit-id: f12061f2b024f046c5e23d40607f2e6814a8fe7d [formerly 5d6e0b8669f70e000e0c06a5a0ac26f8e1304996] [formerly bccb50f7402b88efa2e548c310f2c28349583167 [formerly c9522aa526
]]
Former-commit-id: c21c41181c7bfdfc22fcd7327e4487ea45789220 [formerly 09d8cd5d1a2ba59f0954297c0f5516bf8a5e67b4]
Former-commit-id: dcbe1f78bdc393275263a0af534cbbbf934e578d
pull/726/head
parent
a53adf6d69
commit
b6068b17c4
|
@ -12,12 +12,12 @@
|
||||||
<button @click="openSearch" aria-label="Search" title="Search" class="search-button action">
|
<button @click="openSearch" aria-label="Search" title="Search" class="search-button action">
|
||||||
<i class="material-icons">search</i>
|
<i class="material-icons">search</i>
|
||||||
</button>
|
</button>
|
||||||
<rename-button v-show="!loading && showRenameButton()"></rename-button>
|
<rename-button v-show="!loading && showRenameButton"></rename-button>
|
||||||
<move-button v-show="!loading && showMoveButton()"></move-button>
|
<move-button v-show="!loading && showMoveButton"></move-button>
|
||||||
<delete-button v-show="!loading && showDeleteButton()"></delete-button>
|
<delete-button v-show="!loading && showDeleteButton"></delete-button>
|
||||||
<switch-button v-show="!loading && req.kind !== 'editor'"></switch-button>
|
<switch-button v-show="!loading && req.kind !== 'editor'"></switch-button>
|
||||||
<download-button></download-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>
|
<info-button></info-button>
|
||||||
|
|
||||||
<button v-show="isListing" @click="$store.commit('multiple', true)" aria-label="Select multiple" class="action">
|
<button v-show="isListing" @click="$store.commit('multiple', true)" aria-label="Select multiple" class="action">
|
||||||
|
@ -120,6 +120,43 @@ export default {
|
||||||
},
|
},
|
||||||
isEditor () {
|
isEditor () {
|
||||||
return this.req.kind === 'editor' && !this.loading
|
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 () {
|
data: function () {
|
||||||
|
@ -232,43 +269,6 @@ export default {
|
||||||
},
|
},
|
||||||
openSearch () {
|
openSearch () {
|
||||||
this.$store.commit('showHover', 'search')
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue