SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 7c50b3f2 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Work on attachments in MessageComposer

parent 0722d2a6
No related branches found
No related tags found
No related merge requests found
<template>
<b-row>
<b-col class="col-lg-6">
<b-form-file
multiple
v-model="attachments"
placeholder="Select a file, or drop it here"
drop-placeholder="Drop file here"
>
</b-form-file>
</b-col>
<b-col class="col-lg-6">
<h3>Attachments:</h3>
<ul>
<li
is="attachment-list-item"
v-for="(attachment, index) in attachments"
:key="'att-' + index"
:attachment="attachment"
@remove="attachments.splice(index, 1)"
>
</li>
</ul>
</b-col>
</b-row>
</template>
<script>
import AttachmentListItem from './AttachmentListItem.vue'
export default {
name: "attachment-list-editable",
components: {
AttachmentListItem,
},
props: {
attachments: {
type: Array,
required: true,
}
}
}
</script>
<template>
<li>
{{ attachment.name }}&emsp;({{ attachment.type}}, {{ attachment.size }} bytes)
<b-button class="bg-danger p-1" size="sm" @click.stop="$emit('remove')">
<i class="small fa fa-times text-white"></i>
</b-button>
</li>
</template>
<script>
export default {
name: "attachment-list-item",
props: {
attachment: {
type: File,
required: true,
}
},
}
</script>
...@@ -59,6 +59,13 @@ ...@@ -59,6 +59,13 @@
</b-form-group> </b-form-group>
</b-col> </b-col>
</b-row> </b-row>
<b-form-group
id="attachments"
label="attachments:"
class="mb-4"
>
<attachment-list-editable :attachments="form.attachments"></attachment-list-editable>
</b-form-group>
<b-form-group <b-form-group
id="subject" id="subject"
label="Subject:" label="Subject:"
...@@ -136,12 +143,14 @@ ...@@ -136,12 +143,14 @@
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import EmailListEditable from './EmailListEditable.vue' import EmailListEditable from './EmailListEditable.vue'
import AttachmentListEditable from './AttachmentListEditable.vue'
var csrftoken = Cookies.get('csrftoken'); var csrftoken = Cookies.get('csrftoken');
export default { export default {
name: "message-composer", name: "message-composer",
components: { components: {
AttachmentListEditable,
EmailListEditable, EmailListEditable,
}, },
props: { props: {
...@@ -168,9 +177,11 @@ export default { ...@@ -168,9 +177,11 @@ export default {
subject: '', subject: '',
body: '', body: '',
sanitized_body_html: '', sanitized_body_html: '',
attachments: [],
}, },
newcc: '', newcc: '',
newbcc: '', newbcc: '',
newattachment: null,
from_account_accesses: [], from_account_accesses: [],
response: null, response: null,
response_body_json: null, response_body_json: null,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment