committed by
Julius Härtl
parent
d27a5ac9ba
commit
b90842e717
15
package-lock.json
generated
15
package-lock.json
generated
@@ -3485,6 +3485,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@nextcloud/files": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nextcloud/files/-/files-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-HJF+eavX8BymQ83jGkluNyQ8zrbFfuiQwunSe140sbQ042pjyljSUACf/WyvVAeqaCj7cIeYMPQBtvykom0+cg==",
|
||||||
|
"requires": {
|
||||||
|
"core-js": "3.5.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": {
|
||||||
|
"version": "3.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.5.0.tgz",
|
||||||
|
"integrity": "sha512-Ifh3kj78gzQ7NAoJXeTu+XwzDld0QRIwjBLRqAMhuLhP3d2Av5wmgE9ycfnvK6NAEjTkQ1sDPeoEZAWO3Hx1Uw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@nextcloud/l10n": {
|
"@nextcloud/l10n": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nextcloud/l10n/-/l10n-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@nextcloud/l10n/-/l10n-1.1.0.tgz",
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
"@nextcloud/axios": "^1.3.1",
|
"@nextcloud/axios": "^1.3.1",
|
||||||
"@nextcloud/l10n": "^1.1.0",
|
"@nextcloud/l10n": "^1.1.0",
|
||||||
"@nextcloud/dialogs": "^1.2.1",
|
"@nextcloud/dialogs": "^1.2.1",
|
||||||
|
"@nextcloud/files": "^1.0.0",
|
||||||
"@nextcloud/moment": "^1.1.0",
|
"@nextcloud/moment": "^1.1.0",
|
||||||
"@nextcloud/router": "^1.0.0",
|
"@nextcloud/router": "^1.0.0",
|
||||||
"@nextcloud/vue": "^1.4.0",
|
"@nextcloud/vue": "^1.4.0",
|
||||||
|
|||||||
@@ -29,25 +29,23 @@
|
|||||||
type="file"
|
type="file"
|
||||||
style="display: none;"
|
style="display: none;"
|
||||||
@change="onLocalAttachmentSelected">
|
@change="onLocalAttachmentSelected">
|
||||||
<attachment-list-component>
|
|
||||||
<div class="attachment-list-wrapper">
|
|
||||||
<div class="attachment-list">
|
<div class="attachment-list">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="attachment in attachments" :key="attachment.id" class="attachment">
|
<li v-for="attachment in attachments"
|
||||||
<a class="fileicon" :style="mimetypeForAttachment(attachment)" :href="attachmentUrl(attachment)"
|
:key="attachment.id"
|
||||||
style="background-image: url("/apps/theming/img/core/filetypes/image.svg?v=13");"></a>
|
class="attachment"
|
||||||
|
style="display: flex;">
|
||||||
|
<a class="fileicon" :style="mimetypeForAttachment(attachment)" :href="attachmentUrl(attachment)" />
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<a :href="attachmentUrl(attachment)" target="_blank">
|
<a :href="attachmentUrl(attachment)" target="_blank">
|
||||||
<div class="filename">
|
<div class="filename">
|
||||||
<span class="basename">{{ attachment.data }}</span>
|
<span class="basename">{{ attachment.data }}</span>
|
||||||
<span class="extension">.xxx</span>
|
|
||||||
</div>
|
</div>
|
||||||
<span class="filesize">{{ attachment.extendedData.filesize }}</span>
|
<span class="filesize">{{ formattedFileSize(attachment.extendedData.filesize) }}</span>
|
||||||
<span class="filedate">{{ attachment.createdAt }}</span>
|
<span class="filedate">{{ relativeDate(attachment.createdAt*1000) }}</span>
|
||||||
<span class="filedate">{{ attachment.createdBy }}</span>
|
<span class="filedate">{{ attachment.createdBy }}</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Actions>
|
<Actions>
|
||||||
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="deleteAttachment(attachment)">
|
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="deleteAttachment(attachment)">
|
||||||
{{ t('deck', 'Delete Attachment') }}
|
{{ t('deck', 'Delete Attachment') }}
|
||||||
@@ -57,12 +55,9 @@
|
|||||||
{{ t('deck', 'Restore Attachment') }}
|
{{ t('deck', 'Restore Attachment') }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</Actions>
|
</Actions>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</attachment-list-component>
|
|
||||||
|
|
||||||
<Modal v-if="modalShow" title="File already exists" @close="modalShow=false">
|
<Modal v-if="modalShow" title="File already exists" @close="modalShow=false">
|
||||||
<div class="modal__content">
|
<div class="modal__content">
|
||||||
@@ -89,6 +84,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { Actions, ActionButton, Modal } from '@nextcloud/vue'
|
import { Actions, ActionButton, Modal } from '@nextcloud/vue'
|
||||||
import { showError } from '@nextcloud/dialogs'
|
import { showError } from '@nextcloud/dialogs'
|
||||||
|
import { formatFileSize } from '@nextcloud/files'
|
||||||
|
import relativeDate from '../../mixins/relativeDate'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CardSidebarTabAttachments',
|
name: 'CardSidebarTabAttachments',
|
||||||
@@ -97,6 +94,7 @@ export default {
|
|||||||
ActionButton,
|
ActionButton,
|
||||||
Modal,
|
Modal,
|
||||||
},
|
},
|
||||||
|
mixins: [ relativeDate ],
|
||||||
props: {
|
props: {
|
||||||
card: {
|
card: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -107,13 +105,16 @@ export default {
|
|||||||
return {
|
return {
|
||||||
modalShow: false,
|
modalShow: false,
|
||||||
file: '',
|
file: '',
|
||||||
overwriteAttachment: null
|
overwriteAttachment: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
attachments() {
|
attachments() {
|
||||||
return this.$store.getters.attachmentsByCard(this.card.id)
|
return this.$store.getters.attachmentsByCard(this.card.id)
|
||||||
},
|
},
|
||||||
|
formattedFileSize() {
|
||||||
|
return (filesize) => formatFileSize(filesize)
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
created: function() {
|
created: function() {
|
||||||
@@ -164,7 +165,7 @@ export default {
|
|||||||
this.$store.dispatch('updateAttachment', {
|
this.$store.dispatch('updateAttachment', {
|
||||||
cardId: this.card.id,
|
cardId: this.card.id,
|
||||||
attachmentId: this.overwriteAttachment.id,
|
attachmentId: this.overwriteAttachment.id,
|
||||||
formData: bodyFormData
|
formData: bodyFormData,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.modalShow = false
|
this.modalShow = false
|
||||||
@@ -187,15 +188,6 @@ export default {
|
|||||||
margin: 40px 3px 3px 0;
|
margin: 40px 3px 3px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.attachment-list-wrapper {
|
|
||||||
position: fixed;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-color: rgba(darkgray, 0.5);
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
z-index: 300;
|
|
||||||
}
|
|
||||||
.attachment-list {
|
.attachment-list {
|
||||||
&.selector {
|
&.selector {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ export class AttachmentApi {
|
|||||||
url: this.url(`/cards/${cardId}/attachment/${attachmentId}`),
|
url: this.url(`/cards/${cardId}/attachment/${attachmentId}`),
|
||||||
data: formData,
|
data: formData,
|
||||||
})
|
})
|
||||||
console.log(response)
|
|
||||||
return response.data
|
return response.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export default {
|
|||||||
deleteAttachment(state, deletedAttachment) {
|
deleteAttachment(state, deletedAttachment) {
|
||||||
const existingIndex = state.attachments[deletedAttachment.cardId].findIndex(a => a.id === deletedAttachment.id)
|
const existingIndex = state.attachments[deletedAttachment.cardId].findIndex(a => a.id === deletedAttachment.id)
|
||||||
if (existingIndex !== -1) {
|
if (existingIndex !== -1) {
|
||||||
//state.attachments[deletedAttachment.cardId].splice(existingIndex, 1)
|
// state.attachments[deletedAttachment.cardId].splice(existingIndex, 1)
|
||||||
state.attachments[deletedAttachment.cardId][existingIndex].deletedAt = -1
|
state.attachments[deletedAttachment.cardId][existingIndex].deletedAt = -1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user