feat: add attachments tab

This commit is contained in:
Luka Trovic
2022-02-09 22:00:44 +01:00
parent 3cd94f330f
commit 7d414891f9
2 changed files with 67 additions and 13 deletions

View File

@@ -0,0 +1,36 @@
<template>
<div class="section-details">
<AttachmentList
:card-id="card.id"
:removable="true"
@delete-attachment="deleteAttachment"
@restore-attachment="restoreAttachment" />
</div>
</template>
<script>
import AttachmentList from './AttachmentList'
export default {
components: { AttachmentList },
props: {
card: {
type: Object,
default: null,
},
},
data() {
return {
}
},
methods: {
deleteAttachment(attachment) {
this.$store.dispatch('deleteAttachment', attachment)
},
restoreAttachment(attachment) {
this.$store.dispatch('restoreAttachment', attachment)
},
},
}
</script>

View File

@@ -31,15 +31,15 @@
</p> </p>
</div> </div>
<div class="tabs"> <div class="tabs">
<div class="tab members" :class="{active: activeTab === 'members'}" @click="activeTab = 'members'"> <div class="tab members" :class="{active: activeTab === 'default'}" @click="activeTab = 'default'">
<i class="icon-user icon" /> <i class="icon-user icon" />
Members Members
</div> </div>
<div class="tab tags" :class="{active: activeTab === 'tags'}" @click="activeTab = 'tags'"> <div class="tab tags" :class="{active: activeTab === 'default'}" @click="activeTab = 'default'">
<i class="icon icon-tag" /> <i class="icon icon-tag" />
Tags Tags
</div> </div>
<div class="tab due-date" :class="{active: activeTab === 'duedate'}" @click="activeTab = 'duedate'"> <div class="tab due-date" :class="{active: activeTab === 'default'}" @click="activeTab = 'default'">
<i class="icon icon-calendar-dark" /> <i class="icon icon-calendar-dark" />
Due date Due date
</div> </div>
@@ -47,17 +47,33 @@
<i class="icon icon-deck" /> <i class="icon icon-deck" />
Project Project
</div> </div>
<div class="tab attachments"> <div class="tab attachments" :class="{active: activeTab === 'attachment'}" @click="activeTab = 'attachment'">
<i class="icon-attach icon icon-attach-dark" /> <i class="icon-attach icon icon-attach-dark" />
Attachments Attachments
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<div class="content-tabs"> <div class="content-tabs">
<MembersTab :card="currentCard" @click="activeTab = 'members'" @active-tab="changeActiveTab" /> <MembersTab v-if="activeTab === 'default'"
<TagsTab :card="currentCard" @click="activeTab = 'tags'" @active-tab="changeActiveTab" /> :card="currentCard"
<DueDateTab :card="currentCard" @click="activeTab = 'duedate'" @active-tab="changeActiveTab" /> @click="activeTab = 'default'"
<ProjectTab :card="currentCard" @click="activeTab = 'project'" @active-tab="changeActiveTab" /> @active-tab="changeActiveTab" />
<TagsTab v-if="activeTab === 'default'"
:card="currentCard"
@click="activeTab = 'default'"
@active-tab="changeActiveTab" />
<DueDateTab v-if="activeTab === 'default'"
:card="currentCard"
@click="activeTab = 'default'"
@active-tab="changeActiveTab" />
<ProjectTab v-if="activeTab === 'project'"
:card="currentCard"
@click="activeTab = 'project'"
@active-tab="changeActiveTab" />
<AttachmentsTab v-if="activeTab === 'attachment'"
:card="currentCard"
@click="activeTab = 'attachment'"
@active-tab="changeActiveTab" />
</div> </div>
<Description :key="currentCard.id" :card="currentCard" @change="descriptionChanged" /> <Description :key="currentCard.id" :card="currentCard" @change="descriptionChanged" />
</div> </div>
@@ -76,9 +92,9 @@
:preview="true" :preview="true"
@cancel="cancelReply" /> @cancel="cancelReply" />
<ul v-if="getCommentsForCard(currentCard.id).length > 0" id="commentsFeed"> <ul v-if="getCommentsForCard(currentCard.id).length > 0" id="commentsFeed">
<CommentItem v-for="comment in getCommentsForCard(currentCard.id)" <CommentItem v-for="cmt in getCommentsForCard(currentCard.id)"
:key="comment.id" :key="cmt.id"
:comment="comment" :comment="cmt"
@doReload="loadComments" /> @doReload="loadComments" />
</ul> </ul>
</div> </div>
@@ -98,6 +114,7 @@ import TagsTab from './TagsTab.vue'
import DueDateTab from './DueDateTab.vue' import DueDateTab from './DueDateTab.vue'
import Description from './Description.vue' import Description from './Description.vue'
import ProjectTab from './ProjectTab.vue' import ProjectTab from './ProjectTab.vue'
import AttachmentsTab from './AttachmentsTab.vue'
import CommentForm from './CommentForm' import CommentForm from './CommentForm'
import CommentItem from './CommentItem' import CommentItem from './CommentItem'
@@ -112,6 +129,7 @@ export default {
TagsTab, TagsTab,
DueDateTab, DueDateTab,
ProjectTab, ProjectTab,
AttachmentsTab,
CommentForm, CommentForm,
CommentItem, CommentItem,
}, },
@@ -140,7 +158,7 @@ export default {
hasActivity: capabilities && capabilities.activity, hasActivity: capabilities && capabilities.activity,
currentUser: getCurrentUser(), currentUser: getCurrentUser(),
comment: '', comment: '',
activeTab: 'members', activeTab: 'default',
} }
}, },
computed: { computed: {
@@ -256,7 +274,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.content-tabs { .content-tabs {
display: grid; display: grid;
grid-template-columns: 1fr 2fr 1fr 1fr; grid-template-columns: 1fr 2fr 1fr;
align-items: flex-start; align-items: flex-start;
} }