filebrowser/_assets/src/components/DownloadPrompt.vue
Henrique Dias 8b98abedea Working better :)
Former-commit-id: 935ee3c7cceb4deb31965501a80c202a0034da52 [formerly 3a68553e1ac0af9dad51bd2b8eab1152959a4dc2] [formerly 596f9d6676cceafac0e9fe66a9137683482c2685 [formerly 191b31e9774be6e9a2a12a8336db40fe14eb94b5]]
Former-commit-id: f0179a58c53f057f1b6f0f19b40fc2308b0edd15 [formerly 5151c85d599e8b3772dabab24973004105c29881]
Former-commit-id: c28c7b95e5ea1b1d9ae2af046f49cc5ffa848385
2017-07-03 11:04:14 +01:00

43 lines
1.1 KiB
Vue

<template>
<div class="prompt" id="download">
<h3>Download files</h3>
<p>Choose the format you want to download.</p>
<button @click="download('zip')" autofocus>zip</button>
<button @click="download('tar')" autofocus>tar</button>
<button @click="download('targz')" autofocus>tar.gz</button>
<button @click="download('tarbz2')" autofocus>tar.bz2</button>
<button @click="download('tarxz')" autofocus>tar.xz</button>
</div>
</template>
<script>
import {mapGetters, mapState} from 'vuex'
export default {
name: 'download-prompt',
computed: {
...mapState(['selected', 'req']),
...mapGetters(['selectedCount'])
},
methods: {
download: function (format) {
let uri = `${window.location.pathname}?download=${format}`
if (this.selectedCount > 0) {
let files = ''
for (let i of this.selected) {
files += this.req.items[i].url.replace(window.location.pathname, '') + ','
}
files = files.substring(0, files.length - 1)
files = encodeURIComponent(files)
uri += `&files=${files}`
}
window.open(uri)
}
}
}
</script>