Compare commits

...

1 Commits

Author SHA1 Message Date
Jakob Röhrl
13d57f7a8d attachents in details view
Signed-off-by: Jakob Röhrl <jakob.roehrl@web.de>
2020-12-30 13:30:19 +01:00
3 changed files with 87 additions and 61 deletions

View File

@@ -21,58 +21,65 @@
--> -->
<template> <template>
<AttachmentDragAndDrop :card-id="cardId" class="drop-upload--sidebar"> <div>
<button class="icon-upload" @click="clickAddNewAttachmment()"> <h5>
{{ t('deck', 'Upload attachment') }} {{ t('deck', 'Attachments') }}
</button> <Actions>
<input ref="localAttachments" <ActionButton icon="icon-upload" @click="clickAddNewAttachmment()">
type="file" {{ t('deck', 'Upload attachment') }}
style="display: none;" </ActionButton>
multiple </Actions>
@change="handleUploadFile"> </h5>
<ul class="attachment-list"> <AttachmentDragAndDrop :card-id="cardId" class="drop-upload--sidebar">
<li v-for="attachment in uploadQueue" :key="attachment.name" class="attachment"> <input ref="localAttachments"
<a class="fileicon" :style="mimetypeForAttachment('none')" /> type="file"
<div class="details"> style="display: none;"
<a> multiple
<div class="filename"> @change="handleUploadFile">
<span class="basename">{{ attachment.name }}</span> <ul class="attachment-list">
</div> <li v-for="attachment in uploadQueue" :key="attachment.name" class="attachment">
<progress :value="attachment.progress" max="100" /> <a class="fileicon" :style="mimetypeForAttachment('none')" />
</a> <div class="details">
</div> <a>
</li> <div class="filename">
<li v-for="attachment in attachments" <span class="basename">{{ attachment.name }}</span>
:key="attachment.id" </div>
class="attachment"> <progress :value="attachment.progress" max="100" />
<a class="fileicon" :style="mimetypeForAttachment(attachment.extendedData.mimetype)" :href="attachmentUrl(attachment)" /> </a>
<div class="details"> </div>
<a :href="attachmentUrl(attachment)" target="_blank"> </li>
<div class="filename"> <li v-for="attachment in attachments"
<span class="basename">{{ attachment.data }}</span> :key="attachment.id"
</div> class="attachment">
<span class="filesize">{{ formattedFileSize(attachment.extendedData.filesize) }}</span> <a class="fileicon" :style="mimetypeForAttachment(attachment.extendedData.mimetype)" :href="attachmentUrl(attachment)" />
<span class="filedate">{{ relativeDate(attachment.createdAt*1000) }}</span> <div class="details">
<span class="filedate">{{ attachment.createdBy }}</span> <a :href="attachmentUrl(attachment)" target="_blank">
</a> <div class="filename">
</div> <span class="basename">{{ attachment.data }}</span>
<Actions v-if="selectable"> </div>
<ActionButton icon="icon-confirm" @click="$emit('selectAttachment', attachment)"> <span class="filesize">{{ formattedFileSize(attachment.extendedData.filesize) }}</span>
{{ t('deck', 'Add this attachment') }} <span class="filedate">{{ relativeDate(attachment.createdAt*1000) }}</span>
</ActionButton> <span class="filedate">{{ attachment.createdBy }}</span>
</Actions> </a>
<Actions v-if="removable"> </div>
<ActionButton v-if="attachment.deletedAt === 0" icon="icon-delete" @click="$emit('deleteAttachment', attachment)"> <Actions v-if="selectable">
{{ t('deck', 'Delete Attachment') }} <ActionButton icon="icon-confirm" @click="$emit('selectAttachment', attachment)">
</ActionButton> {{ 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)"> <ActionButton v-else icon="icon-history" @click="$emit('restoreAttachment', attachment)">
{{ t('deck', 'Restore Attachment') }} {{ t('deck', 'Restore Attachment') }}
</ActionButton> </ActionButton>
</Actions> </Actions>
</li> </li>
</ul> </ul>
</AttachmentDragAndDrop> </AttachmentDragAndDrop>
</div>
</template> </template>
<script> <script>
@@ -171,6 +178,21 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
h5 {
border-bottom: 1px solid var(--color-border);
margin-top: 20px;
margin-bottom: 5px;
color: var(--color-text-maxcontrast);
.icon-upload {
background-size: 16px;
float: right;
margin-top: -14px;
opacity: .7;
}
}
.icon-upload { .icon-upload {
padding-left: 35px; padding-left: 35px;
background-position: 10px center; background-position: 10px center;

View File

@@ -46,13 +46,6 @@
<CardSidebarTabDetails :card="currentCard" /> <CardSidebarTabDetails :card="currentCard" />
</AppSidebarTab> </AppSidebarTab>
<AppSidebarTab id="attachments"
:order="1"
:name="t('deck', 'Attachments')"
icon="icon-attach">
<CardSidebarTabAttachments :card="currentCard" />
</AppSidebarTab>
<AppSidebarTab <AppSidebarTab
id="comments" id="comments"
:order="2" :order="2"
@@ -75,7 +68,6 @@
import { ActionButton, AppSidebar, AppSidebarTab } from '@nextcloud/vue' import { ActionButton, AppSidebar, AppSidebarTab } from '@nextcloud/vue'
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
import CardSidebarTabDetails from './CardSidebarTabDetails' import CardSidebarTabDetails from './CardSidebarTabDetails'
import CardSidebarTabAttachments from './CardSidebarTabAttachments'
import CardSidebarTabComments from './CardSidebarTabComments' import CardSidebarTabComments from './CardSidebarTabComments'
import CardSidebarTabActivity from './CardSidebarTabActivity' import CardSidebarTabActivity from './CardSidebarTabActivity'
import relativeDate from '../../mixins/relativeDate' import relativeDate from '../../mixins/relativeDate'
@@ -90,7 +82,6 @@ export default {
AppSidebar, AppSidebar,
AppSidebarTab, AppSidebarTab,
ActionButton, ActionButton,
CardSidebarTabAttachments,
CardSidebarTabComments, CardSidebarTabComments,
CardSidebarTabActivity, CardSidebarTabActivity,
CardSidebarTabDetails, CardSidebarTabDetails,

View File

@@ -117,6 +117,12 @@
type="deck-card" /> type="deck-card" />
</div> </div>
<AttachmentList
:card-id="card.id"
:removable="true"
@deleteAttachment="deleteAttachment"
@restoreAttachment="restoreAttachment" />
<Description :key="card.id" :card="card" /> <Description :key="card.id" :card="card" />
</div> </div>
</template> </template>
@@ -125,7 +131,7 @@
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
import moment from '@nextcloud/moment' import moment from '@nextcloud/moment'
import { Avatar, Actions, ActionButton, Multiselect, DatetimePicker } from '@nextcloud/vue' import { Avatar, Actions, ActionButton, Multiselect, DatetimePicker } from '@nextcloud/vue'
import AttachmentList from './AttachmentList'
import { CollectionList } from 'nextcloud-vue-collections' import { CollectionList } from 'nextcloud-vue-collections'
import Color from '../../mixins/color' import Color from '../../mixins/color'
import { import {
@@ -146,6 +152,7 @@ export default {
ActionButton, ActionButton,
Avatar, Avatar,
CollectionList, CollectionList,
AttachmentList,
}, },
mixins: [Color], mixins: [Color],
props: { props: {
@@ -234,6 +241,12 @@ export default {
this.initialize() this.initialize()
}, },
methods: { methods: {
deleteAttachment(attachment) {
this.$store.dispatch('deleteAttachment', attachment)
},
restoreAttachment(attachment) {
this.$store.dispatch('restoreAttachment', attachment)
},
async initialize() { async initialize() {
if (!this.card) { if (!this.card) {
return return