Set file limit in the chat posting form

This commit is contained in:
eugenijm 2020-05-21 15:48:35 +03:00
parent 6b272b9c99
commit c1faeacee8
5 changed files with 23 additions and 2 deletions

View file

@ -70,6 +70,7 @@
:polls-available="false"
:auto-focus="true"
:placeholder="formPlaceholder"
:file-limit="1"
max-height="160"
@resize="handleResize"
@posted="onPosted"

View file

@ -62,7 +62,8 @@ const mediaUpload = {
}
},
props: [
'dropFiles'
'dropFiles',
'disabled'
],
watch: {
'dropFiles': function (fileInfos) {

View file

@ -1,6 +1,7 @@
<template>
<div
class="media-upload"
:class="{ disabled: disabled }"
@drop.prevent
@dragover.prevent="fileDrag"
@drop="fileDrop"
@ -19,6 +20,7 @@
/>
<input
v-if="uploadReady"
:disabled="disabled"
type="file"
style="position: fixed; top: -100em"
multiple="true"
@ -31,7 +33,22 @@
<script src="./media_upload.js" ></script>
<style lang="scss">
@import '../../_variables.scss';
.media-upload {
&.disabled {
.new-icon {
cursor: not-allowed;
}
&:hover {
i, label {
color: $fallback--faint;
color: var(--faint, $fallback--faint);
}
}
}
.label {
display: inline-block;
}

View file

@ -40,7 +40,8 @@ const PostStatusForm = {
'maxHeight',
'poster',
'preserveFocus',
'autoFocus'
'autoFocus',
'fileLimit'
],
components: {
MediaUpload,

View file

@ -172,6 +172,7 @@
ref="mediaUpload"
class="media-upload-icon"
:drop-files="dropFiles"
:disabled="newStatus.files.length >= fileLimit"
@uploading="disableSubmit"
@uploaded="addMediaFile"
@upload-failed="uploadFailed"