AddAsyncupload: translations and options

This commit is contained in:
nobohan 2022-02-24 10:04:06 +01:00
parent f19a090549
commit 4655892815
2 changed files with 41 additions and 19 deletions

View File

@ -9,26 +9,26 @@
@close="modal.showModal = false"> @close="modal.showModal = false">
<template v-slot:header> <template v-slot:header>
modal-header {{ $t('upload_a_document') }}
</template> </template>
<template v-slot:body> <template v-slot:body>
<div id="dropZoneWrapper" ref="dropZoneWrapper"> <div id="dropZoneWrapper" ref="dropZoneWrapper">
<div <div
data-stored-object="data-stored-object" data-stored-object="data-stored-object"
data-label-preparing="Preparing" :data-label-preparing="$t('data_label_preparing')"
data-label-quiet-button="Download existing file" :data-label-quiet-button="$t('data_label_quiet_button')"
data-label-ready="Ready to show" :data-label-ready="$t('data_label_ready')"
data-dict-file-too-big="File too big" :data-dict-file-too-big="$t('data_dict_file_too_big')"
data-dict-default-message="Drop your file or click here" :data-dict-default-message="$t('data_dict_default_message')"
data-dict-remove-file="Remove file in order to upload a new one" :data-dict-remove-file="$t('data_dict_remove_file')"
data-dict-max-files-exceeded="Max files exceeded. Remove previous files" :data-dict-max-files-exceeded="$t('data_dict_max_files_exceeded')"
data-dict-cancel-upload="Cancel upload" :data-dict-cancel-upload="$t('data_dict_cancel_upload')"
data-dict-cancel-upload-confirm="Are you sure you want to cancel this upload ?" :data-dict-cancel-upload-confirm="$t('data_dict_cancel_upload_confirm')"
data-dict-upload-canceled="Upload canceled" :data-dict-upload-canceled="$t('data_dict_upload_canceled')"
data-dict-remove="Remove existing file" :data-dict-remove="$t('data_dict_remove')"
data-allow-remove="true" :data-allow-remove="!options.required"
data-temp-url-generator="url"> data-temp-url-generator="/asyncupload/temp_url/generate/GET">
<input <input
type="hidden" type="hidden"
data-async-file-upload="data-async-file-upload" data-async-file-upload="data-async-file-upload"
@ -54,7 +54,10 @@
</template> </template>
<template v-slot:footer> <template v-slot:footer>
modal-footer <button class="btn btn-create"
@click.prevent="$emit('addDocument', { })">
{{ $t('action.add')}}
</button>
</template> </template>
</modal> </modal>
@ -66,15 +69,36 @@
import Modal from 'ChillMainAssets/vuejs/_components/Modal'; import Modal from 'ChillMainAssets/vuejs/_components/Modal';
import { searchForZones } from '../../module/async_upload/uploader'; import { searchForZones } from '../../module/async_upload/uploader';
const i18n = {
messages: {
fr: {
upload_a_document: "Téléversez un document",
data_label_preparing: "Chargement...",
data_label_quiet_button: "Téléchargez le fichier existant",
data_label_ready: "Prêt à montrer",
data_dict_file_too_big: "Fichier trop volumineux",
data_dict_default_message: "Glissez votre fichier ou cliquez ici",
data_dict_remove_file: "Enlevez votre fichier pour en téléversez un autre",
data_dict_max_files_exceeded: "Nombre maximum de fichiers atteint. Enlevez les fichiers précédents",
data_dict_cancel_upload: "Annulez le téléversement",
data_dict_cancel_upload_confirm: "Êtes-vous sûr·e de vouloir annuler ce téléversement?",
data_dict_upload_canceled: "Téléversement annulé",
data_dict_remove: "Enlevez le fichier existant",
}
}
};
export default { export default {
name: "AddAsyncUpload", name: "AddAsyncUpload",
components: { components: {
Modal Modal
}, },
i18n,
props: [ props: [
'buttonTitle', 'buttonTitle',
'options' 'options'
], ],
emits: ['addDocument'],
data() { data() {
return { return {
modal: { modal: {
@ -88,9 +112,6 @@ export default {
searchForZones(this.$refs.dropZoneWrapper); searchForZones(this.$refs.dropZoneWrapper);
} }
}, },
// mounted() {
// console.log(this.options)
// },
methods: { methods: {
openModal() { openModal() {
this.modal.showModal = true; this.modal.showModal = true;

View File

@ -166,7 +166,8 @@ export default {
template: null, template: null,
asyncUploadOptions: { asyncUploadOptions: {
maxFiles: 1, maxFiles: 1,
maxPostSize: 15000000 maxPostSize: 15000000,
required: false,
} }
} }
}, },