Skip to content
Snippets Groups Projects
Unverified Commit 13379812 authored by Christoph Wurst's avatar Christoph Wurst
Browse files

Disable local attachments button while uploading

parent 4822cf8b
No related branches found
No related tags found
No related merge requests found
...@@ -30,9 +30,13 @@ ...@@ -30,9 +30,13 @@
</li> </li>
</ul> </ul>
<button class="button" <button class="button"
:disabled="uploading"
v-on:click="onAddLocalAttachment"> v-on:click="onAddLocalAttachment">
<span class="icon-upload"/> <span :class="{ 'icon-upload' : !uploading, 'icon-loading-small': uploading }"/>
{{ t('mail', 'Upload attachment') }} {{ uploading ?
t('mail', 'Uploading …') :
t('mail', 'Upload attachment')
}}
</button> </button>
<button class="button" <button class="button"
v-on:click="onAddCloudAttachment"> v-on:click="onAddCloudAttachment">
...@@ -56,6 +60,11 @@ ...@@ -56,6 +60,11 @@
export default { export default {
name: 'ComposerAttachments', name: 'ComposerAttachments',
data () {
return {
uploading: false,
}
},
props: { props: {
value: { value: {
type: Array, type: Array,
...@@ -79,6 +88,8 @@ ...@@ -79,6 +88,8 @@
this.$emit('input', this.value.concat([attachment])) this.$emit('input', this.value.concat([attachment]))
}, },
onLocalAttachmentSelected (e) { onLocalAttachmentSelected (e) {
this.uploading = true
return Promise.all( return Promise.all(
_.map( _.map(
e.target.files, e.target.files,
...@@ -90,7 +101,9 @@ ...@@ -90,7 +101,9 @@
) )
}) })
) )
).catch(console.error.bind(this)) )
.catch(console.error.bind(this))
.then(() => this.uploading = false)
}, },
onAddCloudAttachment () { onAddCloudAttachment () {
return pickFileOrDirectory(t('mail', 'Choose a file to add as attachment')) return pickFileOrDirectory(t('mail', 'Choose a file to add as attachment'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment