Merge pull request #1740 from nextcloud/enh/addAttachments
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -13962,7 +13962,7 @@
|
|||||||
},
|
},
|
||||||
"os-homedir": {
|
"os-homedir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
"resolved": "http://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
||||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@@ -13979,7 +13979,7 @@
|
|||||||
},
|
},
|
||||||
"os-tmpdir": {
|
"os-tmpdir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
"resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||||
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@@ -14181,7 +14181,7 @@
|
|||||||
},
|
},
|
||||||
"path-is-absolute": {
|
"path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
"resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||||
},
|
},
|
||||||
"path-is-inside": {
|
"path-is-inside": {
|
||||||
@@ -17293,7 +17293,7 @@
|
|||||||
},
|
},
|
||||||
"string_decoder": {
|
"string_decoder": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "~5.1.0"
|
"safe-buffer": "~5.1.0"
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
<div class="board-wrapper">
|
<div class="board-wrapper">
|
||||||
<Controls :board="board" />
|
<Controls :board="board" />
|
||||||
<transition name="fade" mode="out-in">
|
<transition name="fade" mode="out-in">
|
||||||
<div v-if="loading" class="emptycontent" key="loading">
|
<div v-if="loading" key="loading" class="emptycontent">
|
||||||
<div class="icon icon-loading" />
|
<div class="icon icon-loading" />
|
||||||
<h2>{{ t('deck', 'Loading board') }}</h2>
|
<h2>{{ t('deck', 'Loading board') }}</h2>
|
||||||
<p />
|
<p />
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="board && !loading" class="board" key="board">
|
<div v-else-if="board && !loading" key="board" class="board">
|
||||||
<Container lock-axix="y"
|
<Container lock-axix="y"
|
||||||
orientation="horizontal"
|
orientation="horizontal"
|
||||||
:drag-handle-selector="dragHandleSelector"
|
:drag-handle-selector="dragHandleSelector"
|
||||||
@@ -39,13 +39,12 @@
|
|||||||
</Draggable>
|
</Draggable>
|
||||||
</Container>
|
</Container>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="emptycontent" key="notfound">
|
<div v-else key="notfound" class="emptycontent">
|
||||||
<div class="icon icon-deck" />
|
<div class="icon icon-deck" />
|
||||||
<h2>{{ t('deck', 'Board not found') }}</h2>
|
<h2>{{ t('deck', 'Board not found') }}</h2>
|
||||||
<p />
|
<p />
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
201
src/components/card/AttachmentList.vue
Normal file
201
src/components/card/AttachmentList.vue
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
<!--
|
||||||
|
- @copyright Copyright (c) 2020 Jakob Röhrl <jakob.roehrl@web.de>
|
||||||
|
-
|
||||||
|
- @author Jakob Röhrl <jakob.roehrl@web.de>
|
||||||
|
-
|
||||||
|
- @license GNU AGPL version 3 or any later version
|
||||||
|
-
|
||||||
|
- This program is free software: you can redistribute it and/or modify
|
||||||
|
- it under the terms of the GNU Affero General Public License as
|
||||||
|
- published by the Free Software Foundation, either version 3 of the
|
||||||
|
- License, or (at your option) any later version.
|
||||||
|
-
|
||||||
|
- This program is distributed in the hope that it will be useful,
|
||||||
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
- GNU Affero General Public License for more details.
|
||||||
|
-
|
||||||
|
- You should have received a copy of the GNU Affero General Public License
|
||||||
|
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="attachment-list">
|
||||||
|
<ul>
|
||||||
|
<li v-for="attachment in attachments"
|
||||||
|
:key="attachment.id"
|
||||||
|
class="attachment">
|
||||||
|
<a class="fileicon" :style="mimetypeForAttachment(attachment.extendedData.mimetype)" :href="attachmentUrl(attachment)" />
|
||||||
|
<div class="details">
|
||||||
|
<a :href="attachmentUrl(attachment)" target="_blank">
|
||||||
|
<div class="filename">
|
||||||
|
<span class="basename">{{ attachment.data }}</span>
|
||||||
|
</div>
|
||||||
|
<span class="filesize">{{ formattedFileSize(attachment.extendedData.filesize) }}</span>
|
||||||
|
<span class="filedate">{{ relativeDate(attachment.createdAt*1000) }}</span>
|
||||||
|
<span class="filedate">{{ attachment.createdBy }}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<Actions v-if="selectable">
|
||||||
|
<ActionButton icon="icon-confirm" @click="$emit('selectAttachment', attachment)">
|
||||||
|
{{ t('deck', 'Add this attachment') }}
|
||||||
|
</ActionButton>
|
||||||
|
</Actions>
|
||||||
|
<Actions v-if="removable">
|
||||||
|
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="$emit('deleteAttachment', attachment)">
|
||||||
|
{{ t('deck', 'Delete Attachment') }}
|
||||||
|
</ActionButton>
|
||||||
|
|
||||||
|
<ActionButton v-else icon="icon-history" @click="$emit('restoreAttachment', attachment)">
|
||||||
|
{{ t('deck', 'Restore Attachment') }}
|
||||||
|
</ActionButton>
|
||||||
|
</Actions>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Actions, ActionButton } from '@nextcloud/vue'
|
||||||
|
import relativeDate from '../../mixins/relativeDate'
|
||||||
|
import { formatFileSize } from '@nextcloud/files'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AttachmentList',
|
||||||
|
components: {
|
||||||
|
Actions,
|
||||||
|
ActionButton,
|
||||||
|
},
|
||||||
|
mixins: [relativeDate],
|
||||||
|
props: {
|
||||||
|
cardId: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
selectable: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
removable: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
attachments() {
|
||||||
|
return [...this.$store.getters.attachmentsByCard(this.cardId)].sort((a, b) => b.id - a.id)
|
||||||
|
},
|
||||||
|
mimetypeForAttachment() {
|
||||||
|
return (mimetype) => {
|
||||||
|
const url = OC.MimeType.getIconUrl(mimetype)
|
||||||
|
const styles = {
|
||||||
|
'background-image': `url("${url}")`,
|
||||||
|
}
|
||||||
|
return styles
|
||||||
|
}
|
||||||
|
},
|
||||||
|
attachmentUrl() {
|
||||||
|
return (attachment) => OC.generateUrl(`/apps/deck/cards/${attachment.cardId}/attachment/${attachment.id}`)
|
||||||
|
},
|
||||||
|
formattedFileSize() {
|
||||||
|
return (filesize) => formatFileSize(filesize)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.attachment-list {
|
||||||
|
&.selector {
|
||||||
|
padding: 10px;
|
||||||
|
position: absolute;
|
||||||
|
width: 30%;
|
||||||
|
max-width: 500px;
|
||||||
|
min-width: 200px;
|
||||||
|
max-height: 50%;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
background-color: #eee;
|
||||||
|
z-index: 2;
|
||||||
|
border-radius: 3px;
|
||||||
|
box-shadow: 0 0 3px darkgray;
|
||||||
|
overflow: scroll;
|
||||||
|
}
|
||||||
|
h3.attachment-selector {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
padding: 0;
|
||||||
|
.icon-close {
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
li.attachment {
|
||||||
|
display: flex;
|
||||||
|
padding: 3px;
|
||||||
|
min-height: 44px;
|
||||||
|
|
||||||
|
&.deleted {
|
||||||
|
opacity: .5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fileicon {
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 32px;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
.details {
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-shrink: 1;
|
||||||
|
min-width: 0;
|
||||||
|
flex-basis: 50%;
|
||||||
|
line-height: 110%;
|
||||||
|
padding: 2px;
|
||||||
|
}
|
||||||
|
.filename {
|
||||||
|
width: 70%;
|
||||||
|
display: flex;
|
||||||
|
.basename {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
}
|
||||||
|
.extension {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.filesize, .filedate {
|
||||||
|
font-size: 90%;
|
||||||
|
color: darkgray;
|
||||||
|
}
|
||||||
|
.app-popover-menu-utils {
|
||||||
|
position: relative;
|
||||||
|
right: -10px;
|
||||||
|
button {
|
||||||
|
height: 32px;
|
||||||
|
width: 42px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button.icon-history {
|
||||||
|
width: 44px;
|
||||||
|
}
|
||||||
|
progress {
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -127,6 +127,11 @@
|
|||||||
href="https://deck.readthedocs.io/en/latest/Markdown/"
|
href="https://deck.readthedocs.io/en/latest/Markdown/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="icon icon-info" />
|
class="icon icon-info" />
|
||||||
|
<Actions v-if="canEdit">
|
||||||
|
<ActionButton v-if="descriptionEditing" icon="icon-attach" @click="showAttachmentModal()">
|
||||||
|
{{ t('deck', 'Add Attachment') }}
|
||||||
|
</ActionButton>
|
||||||
|
</Actions>
|
||||||
<Actions v-if="canEdit">
|
<Actions v-if="canEdit">
|
||||||
<ActionButton v-if="!descriptionEditing" icon="icon-rename" @click="showEditor()">
|
<ActionButton v-if="!descriptionEditing" icon="icon-rename" @click="showEditor()">
|
||||||
{{ t('deck', 'Edit description') }}
|
{{ t('deck', 'Edit description') }}
|
||||||
@@ -170,11 +175,20 @@
|
|||||||
icon="icon-activity">
|
icon="icon-activity">
|
||||||
<CardSidebarTabActivity :card="currentCard" />
|
<CardSidebarTabActivity :card="currentCard" />
|
||||||
</AppSidebarTab>
|
</AppSidebarTab>
|
||||||
|
<Modal v-if="modalShow" :title="t('deck', 'Choose attachment')" @close="modalShow=false">
|
||||||
|
<div class="modal__content">
|
||||||
|
<h3>{{ t('deck', 'Choose attachment') }}</h3>
|
||||||
|
<AttachmentList
|
||||||
|
:card-id="currentCard.id"
|
||||||
|
:selectable="true"
|
||||||
|
@selectAttachment="addAttachment" />
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
</AppSidebar>
|
</AppSidebar>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Avatar, Actions, ActionButton, Multiselect, AppSidebar, AppSidebarTab, DatetimePicker } from '@nextcloud/vue'
|
import { Avatar, Actions, ActionButton, Multiselect, AppSidebar, AppSidebarTab, DatetimePicker, Modal } from '@nextcloud/vue'
|
||||||
import { mapState, mapGetters } from 'vuex'
|
import { mapState, mapGetters } from 'vuex'
|
||||||
import Color from '../../mixins/color'
|
import Color from '../../mixins/color'
|
||||||
import { CollectionList } from 'nextcloud-vue-collections'
|
import { CollectionList } from 'nextcloud-vue-collections'
|
||||||
@@ -183,6 +197,9 @@ import CardSidebarTabComments from './CardSidebarTabComments'
|
|||||||
import CardSidebarTabActivity from './CardSidebarTabActivity'
|
import CardSidebarTabActivity from './CardSidebarTabActivity'
|
||||||
import MarkdownIt from 'markdown-it'
|
import MarkdownIt from 'markdown-it'
|
||||||
import MarkdownItTaskLists from 'markdown-it-task-lists'
|
import MarkdownItTaskLists from 'markdown-it-task-lists'
|
||||||
|
import { formatFileSize } from '@nextcloud/files'
|
||||||
|
import relativeDate from '../../mixins/relativeDate'
|
||||||
|
import AttachmentList from './AttachmentList'
|
||||||
|
|
||||||
const markdownIt = new MarkdownIt()
|
const markdownIt = new MarkdownIt()
|
||||||
markdownIt.use(MarkdownItTaskLists, { enabled: true, label: true, labelAfter: true })
|
markdownIt.use(MarkdownItTaskLists, { enabled: true, label: true, labelAfter: true })
|
||||||
@@ -204,10 +221,10 @@ export default {
|
|||||||
CardSidebarTabAttachments,
|
CardSidebarTabAttachments,
|
||||||
CardSidebarTabComments,
|
CardSidebarTabComments,
|
||||||
CardSidebarTabActivity,
|
CardSidebarTabActivity,
|
||||||
|
Modal,
|
||||||
|
AttachmentList,
|
||||||
},
|
},
|
||||||
mixins: [
|
mixins: [Color, relativeDate],
|
||||||
Color,
|
|
||||||
],
|
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -237,6 +254,7 @@ export default {
|
|||||||
descriptionSaving: false,
|
descriptionSaving: false,
|
||||||
hasActivity: capabilities && capabilities.activity,
|
hasActivity: capabilities && capabilities.activity,
|
||||||
hasComments: !!OC.appswebroots['comments'],
|
hasComments: !!OC.appswebroots['comments'],
|
||||||
|
modalShow: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -244,6 +262,24 @@ export default {
|
|||||||
currentBoard: state => state.currentBoard,
|
currentBoard: state => state.currentBoard,
|
||||||
}),
|
}),
|
||||||
...mapGetters(['canEdit', 'assignables']),
|
...mapGetters(['canEdit', 'assignables']),
|
||||||
|
attachments() {
|
||||||
|
return [...this.$store.getters.attachmentsByCard(this.id)].sort((a, b) => b.id - a.id)
|
||||||
|
},
|
||||||
|
mimetypeForAttachment() {
|
||||||
|
return (mimetype) => {
|
||||||
|
const url = OC.MimeType.getIconUrl(mimetype)
|
||||||
|
const styles = {
|
||||||
|
'background-image': `url("${url}")`,
|
||||||
|
}
|
||||||
|
return styles
|
||||||
|
}
|
||||||
|
},
|
||||||
|
attachmentUrl() {
|
||||||
|
return (attachment) => OC.generateUrl(`/apps/deck/cards/${attachment.cardId}/attachment/${attachment.id}`)
|
||||||
|
},
|
||||||
|
formattedFileSize() {
|
||||||
|
return (filesize) => formatFileSize(filesize)
|
||||||
|
},
|
||||||
currentCard() {
|
currentCard() {
|
||||||
return this.$store.getters.cardById(this.id)
|
return this.$store.getters.cardById(this.id)
|
||||||
},
|
},
|
||||||
@@ -330,6 +366,19 @@ export default {
|
|||||||
hideEditor() {
|
hideEditor() {
|
||||||
this.descriptionEditing = false
|
this.descriptionEditing = false
|
||||||
},
|
},
|
||||||
|
showAttachmentModal() {
|
||||||
|
this.modalShow = true
|
||||||
|
},
|
||||||
|
addAttachment(attachment) {
|
||||||
|
const descString = this.$refs.markdownEditor.easymde.value()
|
||||||
|
let embed = ''
|
||||||
|
if (attachment.extendedData.mimetype.includes('image')) {
|
||||||
|
embed = '!'
|
||||||
|
}
|
||||||
|
const attachmentString = embed + '[📎 ' + attachment.data + '](' + this.attachmentUrl(attachment) + ')'
|
||||||
|
this.$refs.markdownEditor.easymde.value(descString + '\n' + attachmentString)
|
||||||
|
this.modalShow = false
|
||||||
|
},
|
||||||
clickedPreview(e) {
|
clickedPreview(e) {
|
||||||
if (e.target.getAttribute('type') === 'checkbox') {
|
if (e.target.getAttribute('type') === 'checkbox') {
|
||||||
const clickedIndex = [...document.querySelector('#description-preview').querySelectorAll('input')].findIndex((li) => li.id === e.target.id)
|
const clickedIndex = [...document.querySelector('#description-preview').querySelectorAll('input')].findIndex((li) => li.id === e.target.id)
|
||||||
@@ -463,6 +512,13 @@ export default {
|
|||||||
opacity: .7;
|
opacity: .7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-attach {
|
||||||
|
background-size: 16px;
|
||||||
|
float: right;
|
||||||
|
margin-top: -14px;
|
||||||
|
opacity: .7;
|
||||||
|
}
|
||||||
|
|
||||||
.icon-toggle, .icon-rename {
|
.icon-toggle, .icon-rename {
|
||||||
float: right;
|
float: right;
|
||||||
margin-top: -14px;
|
margin-top: -14px;
|
||||||
@@ -542,4 +598,18 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal__content {
|
||||||
|
width: 25vw;
|
||||||
|
min-width: 250px;
|
||||||
|
height: 120px;
|
||||||
|
text-align: center;
|
||||||
|
margin: 20px 20px 60px 20px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal__content button {
|
||||||
|
float: right;
|
||||||
|
margin: 40px 3px 3px 0;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -43,53 +43,32 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li v-for="attachment in attachments"
|
|
||||||
:key="attachment.id"
|
|
||||||
class="attachment">
|
|
||||||
<a class="fileicon" :style="mimetypeForAttachment(attachment.extendedData.mimetype)" :href="attachmentUrl(attachment)" />
|
|
||||||
<div class="details">
|
|
||||||
<a :href="attachmentUrl(attachment)" target="_blank">
|
|
||||||
<div class="filename">
|
|
||||||
<span class="basename">{{ attachment.data }}</span>
|
|
||||||
</div>
|
|
||||||
<span class="filesize">{{ formattedFileSize(attachment.extendedData.filesize) }}</span>
|
|
||||||
<span class="filedate">{{ relativeDate(attachment.createdAt*1000) }}</span>
|
|
||||||
<span class="filedate">{{ attachment.createdBy }}</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<Actions>
|
|
||||||
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="deleteAttachment(attachment)">
|
|
||||||
{{ t('deck', 'Delete Attachment') }}
|
|
||||||
</ActionButton>
|
|
||||||
|
|
||||||
<ActionButton v-else icon="icon-history" @click="restoreAttachment(attachment)">
|
<AttachmentList
|
||||||
{{ t('deck', 'Restore Attachment') }}
|
:card-id="card.id"
|
||||||
</ActionButton>
|
:removable="true"
|
||||||
</Actions>
|
@deleteAttachment="deleteAttachment"
|
||||||
</li>
|
@restoreAttachment="restoreAttachment" />
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</AttachmentDragAndDrop>
|
</AttachmentDragAndDrop>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Actions, ActionButton } from '@nextcloud/vue'
|
|
||||||
import { formatFileSize } from '@nextcloud/files'
|
|
||||||
import relativeDate from '../../mixins/relativeDate'
|
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import { loadState } from '@nextcloud/initial-state'
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
import AttachmentDragAndDrop from '../AttachmentDragAndDrop'
|
import AttachmentDragAndDrop from '../AttachmentDragAndDrop'
|
||||||
import attachmentUpload from '../../mixins/attachmentUpload'
|
import attachmentUpload from '../../mixins/attachmentUpload'
|
||||||
|
import AttachmentList from './AttachmentList'
|
||||||
const maxUploadSizeState = loadState('deck', 'maxUploadSize')
|
const maxUploadSizeState = loadState('deck', 'maxUploadSize')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CardSidebarTabAttachments',
|
name: 'CardSidebarTabAttachments',
|
||||||
components: {
|
components: {
|
||||||
Actions,
|
|
||||||
ActionButton,
|
|
||||||
AttachmentDragAndDrop,
|
AttachmentDragAndDrop,
|
||||||
|
AttachmentList,
|
||||||
},
|
},
|
||||||
mixins: [ relativeDate, attachmentUpload ],
|
mixins: [ attachmentUpload ],
|
||||||
props: {
|
props: {
|
||||||
card: {
|
card: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -122,9 +101,6 @@ export default {
|
|||||||
attachments() {
|
attachments() {
|
||||||
return [...this.$store.getters.attachmentsByCard(this.card.id)].sort((a, b) => b.id - a.id)
|
return [...this.$store.getters.attachmentsByCard(this.card.id)].sort((a, b) => b.id - a.id)
|
||||||
},
|
},
|
||||||
formattedFileSize() {
|
|
||||||
return (filesize) => formatFileSize(filesize)
|
|
||||||
},
|
|
||||||
mimetypeForAttachment() {
|
mimetypeForAttachment() {
|
||||||
return (mimetype) => {
|
return (mimetype) => {
|
||||||
const url = OC.MimeType.getIconUrl(mimetype)
|
const url = OC.MimeType.getIconUrl(mimetype)
|
||||||
@@ -134,9 +110,6 @@ export default {
|
|||||||
return styles
|
return styles
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
attachmentUrl() {
|
|
||||||
return (attachment) => OC.generateUrl(`/apps/deck/cards/${attachment.cardId}/attachment/${attachment.id}`)
|
|
||||||
},
|
|
||||||
cardId() {
|
cardId() {
|
||||||
return this.card.id
|
return this.card.id
|
||||||
},
|
},
|
||||||
@@ -155,7 +128,6 @@ export default {
|
|||||||
clickAddNewAttachmment() {
|
clickAddNewAttachmment() {
|
||||||
this.$refs.localAttachments.click()
|
this.$refs.localAttachments.click()
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteAttachment(attachment) {
|
deleteAttachment(attachment) {
|
||||||
this.$store.dispatch('deleteAttachment', attachment)
|
this.$store.dispatch('deleteAttachment', attachment)
|
||||||
},
|
},
|
||||||
@@ -172,19 +144,6 @@ export default {
|
|||||||
background-position: 10px center;
|
background-position: 10px center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal__content {
|
|
||||||
width: 25vw;
|
|
||||||
min-width: 250px;
|
|
||||||
height: 120px;
|
|
||||||
text-align: center;
|
|
||||||
margin: 20px 20px 60px 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal__content button {
|
|
||||||
float: right;
|
|
||||||
margin: 40px 3px 3px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attachment-list {
|
.attachment-list {
|
||||||
&.selector {
|
&.selector {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
Reference in New Issue
Block a user