Disable the submit button and apply error class to the characters left indicator
This commit is contained in:
parent
ea6ee2aaa2
commit
591dadad13
2 changed files with 6 additions and 1 deletions
|
@ -106,6 +106,9 @@ const PostStatusForm = {
|
||||||
},
|
},
|
||||||
charactersLeft () {
|
charactersLeft () {
|
||||||
return this.statusLengthLimit - this.statusLength
|
return this.statusLengthLimit - this.statusLength
|
||||||
|
},
|
||||||
|
isOverLengthLimit () {
|
||||||
|
return this.hasStatusLengthLimit && (this.statusLength > this.statusLengthLimit)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -19,9 +19,11 @@
|
||||||
<div class='form-bottom'>
|
<div class='form-bottom'>
|
||||||
<media-upload @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="enableSubmit" :drop-files="dropFiles"></media-upload>
|
<media-upload @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="enableSubmit" :drop-files="dropFiles"></media-upload>
|
||||||
|
|
||||||
<p v-if="hasStatusLengthLimit" class="base04">{{ charactersLeft }}</p>
|
<p v-if="isOverLengthLimit" class="error">{{ charactersLeft }}</p>
|
||||||
|
<p v-else-if="hasStatusLengthLimit" class="base04">{{ charactersLeft }}</p>
|
||||||
|
|
||||||
<button v-if="posting" disabled class="btn btn-default base05 base02-background">{{$t('post_status.posting')}}</button>
|
<button v-if="posting" disabled class="btn btn-default base05 base02-background">{{$t('post_status.posting')}}</button>
|
||||||
|
<button v-else-if="isOverLengthLimit" disabled class="btn btn-default base05 base02-background">{{$t('general.submit')}}</button>
|
||||||
<button v-else :disabled="submitDisabled" type="submit" class="btn btn-default base05 base02-background">{{$t('general.submit')}}</button>
|
<button v-else :disabled="submitDisabled" type="submit" class="btn btn-default base05 base02-background">{{$t('general.submit')}}</button>
|
||||||
</div>
|
</div>
|
||||||
<div class='error' v-if="error">
|
<div class='error' v-if="error">
|
||||||
|
|
Loading…
Reference in a new issue