Skip to content

Commit

Permalink
feat: duplicate files in the same directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiresviana committed Jul 17, 2020
1 parent 2636f87 commit 43526d9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
9 changes: 8 additions & 1 deletion frontend/src/components/files/Listing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ export default {
this.$store.commit('updateClipboard', {
key: key,
items: items
items: items,
path: this.$route.path
})
},
paste (event) {
Expand Down Expand Up @@ -282,6 +283,12 @@ export default {
}
}
if (this.$store.state.clipboard.path == this.$route.path) {
action(false, true)
return
}
let conflict = upload.checkConflict(items, this.req.items)
let overwrite = false
Expand Down
15 changes: 14 additions & 1 deletion frontend/src/components/prompts/Copy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
:title="$t('buttons.cancel')">{{ $t('buttons.cancel') }}</button>
<button class="button button--flat"
@click="copy"
:disabled="$route.path === dest"
:aria-label="$t('buttons.copy')"
:title="$t('buttons.copy')">{{ $t('buttons.copy') }}</button>
</div>
Expand Down Expand Up @@ -59,13 +58,27 @@ export default {
await api.copy(items, overwrite, rename).then(() => {
buttons.success('copy')
if (this.$route.path === this.dest) {
this.$store.commit('setReload', true)
return
}
this.$router.push({ path: this.dest })
}).catch((e) => {
buttons.done('copy')
this.$showError(e)
})
}
if (this.$route.path === this.dest) {
this.$store.commit('closeHovers')
action(false, true)
return
}
let dstItems = (await api.fetch(this.dest)).items
let conflict = upload.checkConflict(items, dstItems)
Expand Down
1 change: 1 addition & 0 deletions frontend/src/store/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const mutations = {
updateClipboard: (state, value) => {
state.clipboard.key = value.key
state.clipboard.items = value.items
state.clipboard.path = value.path
},
resetClipboard: (state) => {
state.clipboard.key = ''
Expand Down

0 comments on commit 43526d9

Please sign in to comment.