mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
AccompanyingCourseWorkEdit: download existing documents
This commit is contained in:
parent
9f0ab5aee7
commit
1beae4d713
@ -61,13 +61,13 @@ class StoredObject implements AsyncFileInterface, Document
|
||||
/**
|
||||
* @var int[]
|
||||
* @ORM\Column(type="json", name="iv")
|
||||
* @Serializer\Groups({"write"})
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private array $iv = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", name="key")
|
||||
* @Serializer\Groups({"write"})
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private array $keyInfos = [];
|
||||
|
||||
|
@ -73,6 +73,7 @@ var download = (button) => {
|
||||
button.type = mimeType;
|
||||
button.textContent = labelReady;
|
||||
if (hasFilename) {
|
||||
|
||||
button.download = filename;
|
||||
if (extension !== false) {
|
||||
button.download = button.download + '.' + extension;
|
||||
@ -92,4 +93,4 @@ window.addEventListener('load', function(e) {
|
||||
initializeButtons(e.target);
|
||||
});
|
||||
|
||||
module.exports = initializeButtons;
|
||||
export { initializeButtons, download };
|
@ -1,6 +1,6 @@
|
||||
var algo = 'AES-CBC';
|
||||
import Dropzone from 'dropzone';
|
||||
var initializeDownload = require('./downloader.js');
|
||||
import { initializeButtons } from './downloader.js';
|
||||
|
||||
|
||||
/**
|
||||
@ -359,7 +359,7 @@ var insertDownloadButton = (zone, zoneData) => {
|
||||
|
||||
addBelowButton(newButton, zone, zoneData);
|
||||
//zone.appendChild(newButton);
|
||||
initializeDownload(zone);
|
||||
initializeButtons(zone);
|
||||
};
|
||||
|
||||
window.addEventListener('load', function(e) {
|
||||
|
@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<a
|
||||
class="btn btn-download"
|
||||
:title="$t(buttonTitle)"
|
||||
:data-key=JSON.stringify(storedObject.keyInfos)
|
||||
:data-iv=JSON.stringify(storedObject.iv)
|
||||
:data-mime-type=storedObject.type
|
||||
:data-label-preparing="$t('dataLabelPreparing')"
|
||||
:data-label-ready="$t('dataLabelReady')"
|
||||
:data-temp-url-get-generator="url"
|
||||
@click.once="downloadDocument">
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { download } from '../../module/async_upload/downloader';
|
||||
|
||||
const i18n = {
|
||||
messages: {
|
||||
fr: {
|
||||
dataLabelPreparing: "Chargement...",
|
||||
dataLabelReady: "",
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
name: "AddAsyncUploadDownloader",
|
||||
i18n,
|
||||
props: [
|
||||
'buttonTitle',
|
||||
'storedObject'
|
||||
],
|
||||
computed: {
|
||||
url() {
|
||||
return `/asyncupload/temp_url/generate/GET?object_name=${this.storedObject.filename}`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
downloadDocument(e) {
|
||||
download(e.target);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -108,6 +108,14 @@
|
||||
>
|
||||
</add-async-upload>
|
||||
</li>
|
||||
<li>
|
||||
<add-async-upload-downloader
|
||||
:buttonTitle="$t('download')"
|
||||
:storedObject="d.storedObject"
|
||||
>
|
||||
</add-async-upload-downloader>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a :href="buildEditLink(d.storedObject)" class="btn btn-wopilink"></a>
|
||||
</li>
|
||||
@ -162,6 +170,7 @@ import { mapGetters, mapState } from 'vuex';
|
||||
import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue';
|
||||
import {buildLink} from 'ChillDocGeneratorAssets/lib/document-generator';
|
||||
import AddAsyncUpload from 'ChillDocStoreAssets/vuejs/_components/AddAsyncUpload.vue';
|
||||
import AddAsyncUploadDownloader from 'ChillDocStoreAssets/vuejs/_components/AddAsyncUploadDownloader.vue';
|
||||
import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue';
|
||||
import {buildLinkCreate} from 'ChillMainAssets/lib/entity-workflow/api.js';
|
||||
|
||||
@ -187,7 +196,8 @@ const i18n = {
|
||||
document_title: "Titre du document",
|
||||
template_title: "Nom du template",
|
||||
browse: "Ajouter un document",
|
||||
replace: "Remplacer"
|
||||
replace: "Remplacer",
|
||||
download: "Télécharger le fichier existant"
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -199,6 +209,7 @@ export default {
|
||||
ckeditor: CKEditor.component,
|
||||
PickTemplate,
|
||||
AddAsyncUpload,
|
||||
AddAsyncUploadDownloader,
|
||||
ListWorkflowModal,
|
||||
},
|
||||
i18n,
|
||||
|
Loading…
x
Reference in New Issue
Block a user