Fix and simplify move.

Former-commit-id: 11231eb1b5c72c27228d955860a38e2dfc4c43c3 [formerly 57e14f4919d0759f80557217ff44d85e60fb6686] [formerly 71a61718832107ad72f26aab12810441ecc0c45f [formerly 32e66bb9c6b240e0331ae3c7564a890155bd153f]]
Former-commit-id: 2268fe7634998e21643933753d3122eefaa35e6f [formerly 2b2fa73458b97b20eae798a613c9385db9b80b05]
Former-commit-id: 1d792dfd5cb699068835ae06ae15042524357e53
This commit is contained in:
Henrique Dias
2017-07-08 11:12:43 +01:00
parent ee55b9fd9c
commit 60718b0eef
5 changed files with 89 additions and 95 deletions

View File

@@ -70,7 +70,6 @@ export default {
},
created () {
this.fetchData()
console.log('created')
},
watch: {
'$route': 'fetchData',
@@ -96,16 +95,16 @@ export default {
if (url[0] !== '/') url = '/' + url
api.fetch(url)
.then((trueURL) => {
if (!url.endsWith('/') && trueURL.endsWith('/')) {
console.log(trueURL)
.then((req) => {
if (!url.endsWith('/') && req.url.endsWith('/')) {
window.history.replaceState(window.history.state, document.title, window.location.pathname + '/')
}
this.$store.commit('updateRequest', req)
document.title = req.name
this.setLoading(false)
})
.catch(error => {
console.log(error)
this.error = error
this.setLoading(false)
})
@@ -130,9 +129,13 @@ export default {
// Del!
if (event.keyCode === 46) {
if (this.showDeleteButton && this.req.kind !== 'editor') {
this.$store.commit('showHover', 'delete')
}
if (this.req.kind === 'editor' ||
this.$route.name !== 'Files' ||
this.loading ||
!this.user.allowEdit ||
(this.req.kind === 'listing' && this.selectedCount === 0)) return
this.$store.commit('showHover', 'delete')
}
// F1!
@@ -143,9 +146,14 @@ export default {
// F2!
if (event.keyCode === 113) {
if (this.showRenameButton) {
this.$store.commit('showHover', 'rename')
}
if (this.req.kind === 'editor' ||
this.$route.name !== 'Files' ||
this.loading ||
!this.user.allowEdit ||
(this.req.kind === 'listing' && this.selectedCount === 0) ||
(this.req.kind === 'listing' && this.selectedCount > 1)) return
this.$store.commit('showHover', 'rename')
}
// CTRL + S