mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-24 00:23:50 +00:00
AccompanyingCourseWorkEdit: download existing documents
This commit is contained in:
@@ -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>
|
Reference in New Issue
Block a user