Commit 96b49974 authored by dtluna's avatar dtluna
Browse files

Disable the submit button while uploading attachment

parent 93be4530
......@@ -22,12 +22,14 @@ const PostStatusForm = {
props: [
'replyTo',
'repliedUser',
'attentions'
'attentions',
'submitDisabled'
],
components: {
MediaUpload
},
data () {
this.submitDisabled = false
let statusText = ''
if (this.replyTo) {
......@@ -58,6 +60,13 @@ const PostStatusForm = {
},
addMediaFile (fileInfo) {
this.newStatus.files.push(fileInfo)
this.enableSubmit()
},
disableSubmit () {
this.submitDisabled = true
},
enableSubmit () {
this.submitDisabled = false
}
}
}
......
<template>
<div class="post-status-form">
<form v-on:submit.prevent="postStatus(newStatus)">
<form @submit.prevent="postStatus(newStatus)">
<div class="form-group" >
<textarea v-model="newStatus.status" placeholder="Just landed in L.A." rows="3" class="form-control"></textarea>
</div>
......@@ -10,8 +10,8 @@
</div>
</div>
<div class='form-bottom'>
<media-upload v-on:uploaded="addMediaFile"></media-upload>
<button type="submit" class="btn btn-default" >Submit</button>
<media-upload @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="enableSubmit"></media-upload>
<button :disabled="submitDisabled" type="submit" class="btn btn-default">Submit</button>
</div>
</form>
</div>
......@@ -49,6 +49,10 @@
.btn {
cursor: pointer;
}
.btn[disabled] {
cursor: not-allowed;
}
}
</style>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment