33 - SPDX-License-Identifier: AGPL-3.0-or-later
44-->
55
6+ <!-- eslint-disable vue/no-v-model-argument -->
67<template >
78 <NcAppSidebar v-if =" currentBoard && currentCard "
89 ref="cardSidebar"
10+ v-model :name-editable =" isEditingTitle "
911 :active =" tabId "
1012 :name =" displayTitle "
1113 :subname =" subtitle "
1214 :subtitle =" subtitleTooltip "
13- :name-editable .sync =" isEditingTitle "
14- @update :name =" (value ) => titleEditing = value "
15+ @update :name =" value => titleEditing = value "
1516 @dismiss-editing =" titleEditing = currentCard .title "
1617 @submit-name =" handleSubmitTitle "
1718 @opened =" focusHeader "
2425 {{ t('deck', 'Open in bigger view') }}
2526 </NcActionButton >
2627
27- <CardMenuEntries :card =" currentCard " :hide-details-entry =" true " />
28+ <NcActionButton v-if =" canEdit && ! isCurrentUserAssigned "
29+ icon="icon-user"
30+ :close-after-click =" true "
31+ @click =" assignCardToMe ()" >
32+ {{ t('deck', 'Assign to me') }}
33+ </NcActionButton >
34+ <NcActionButton v-if =" canEdit && isCurrentUserAssigned "
35+ icon="icon-user"
36+ :close-after-click =" true "
37+ @click =" unassignCardFromMe ()" >
38+ {{ t('deck', 'Unassign myself') }}
39+ </NcActionButton >
40+ <NcActionButton v-if =" canEdit "
41+ icon="icon-checkmark"
42+ :close-after-click =" true "
43+ @click =" changeCardDoneStatus ()" >
44+ {{ currentCard.done ? t('deck', 'Mark as not done') : t('deck', 'Mark as done') }}
45+ </NcActionButton >
46+ <NcActionButton v-if =" canEdit "
47+ icon="icon-external"
48+ :close-after-click =" true "
49+ @click =" openCardMoveDialog " >
50+ {{ t('deck', 'Move/copy card') }}
51+ </NcActionButton >
52+ <NcActionButton v-for =" action in cardActions "
53+ :key =" action .label "
54+ :close-after-click =" true "
55+ :icon =" action .icon "
56+ @click =" action .callback (cardRichObject )" >
57+ {{ action.label }}
58+ </NcActionButton >
59+ <NcActionButton v-if =" canEditBoard " :close-after-click =" true " @click =" archiveUnarchiveCard ()" >
60+ <template #icon >
61+ <ArchiveIcon :size =" 20 " decorative />
62+ </template >
63+ {{ currentCard.archived ? t('deck', 'Unarchive card') : t('deck', 'Archive card') }}
64+ </NcActionButton >
65+ <NcActionButton v-if =" canEdit "
66+ icon="icon-delete"
67+ :close-after-click =" true "
68+ @click =" deleteCard ()" >
69+ {{ t('deck', 'Delete card') }}
70+ </NcActionButton >
2871 </template >
2972 <template #description >
30- <NcReferenceList v-if =" currentCard .referenceData "
31- :text =" currentCard .title "
32- :interactive =" false " />
73+ <NcReferenceList v-if =" currentCard .referenceData " :text =" currentCard .title " :interactive =" false " />
3374 </template >
3475
35- <NcAppSidebarTab id="details"
36- :order =" 0 "
37- :name =" t (' deck' , ' Details' )" >
76+ <NcAppSidebarTab id="details" :order =" 0 " :name =" t (' deck' , ' Details' )" >
3877 <CardSidebarTabDetails :card =" currentCard " />
3978 <template #icon >
4079 <HomeIcon :size =" 20 " />
4180 </template >
4281 </NcAppSidebarTab >
4382
44- <NcAppSidebarTab id="attachments"
45- :order =" 1 "
46- :name =" t (' deck' , ' Attachments' )" >
83+ <NcAppSidebarTab id="attachments" :order =" 1 " :name =" t (' deck' , ' Attachments' )" >
4784 <template #icon >
4885 <AttachmentIcon :size =" 20 " />
4986 </template >
5087 <CardSidebarTabAttachments :card =" currentCard " />
5188 </NcAppSidebarTab >
5289
53- <NcAppSidebarTab id="comments"
54- :order =" 2 "
55- :name =" t (' deck' , ' Comments' )" >
90+ <NcAppSidebarTab id="comments" :order =" 2 " :name =" t (' deck' , ' Comments' )" >
5691 <template #icon >
5792 <CommentIcon :size =" 20 " />
5893 </template >
@@ -86,9 +121,15 @@ import HomeIcon from 'vue-material-design-icons/Home.vue'
86121import CommentIcon from ' vue-material-design-icons/Comment.vue'
87122import ActivityIcon from ' vue-material-design-icons/LightningBolt.vue'
88123
89- import { showError , showWarning } from ' @nextcloud/dialogs'
124+ import { showError , showWarning , showUndo } from ' @nextcloud/dialogs'
90125import { getLocale } from ' @nextcloud/l10n'
91- import CardMenuEntries from ' ../cards/CardMenuEntries.vue'
126+ import { emit } from ' @nextcloud/event-bus'
127+
128+ import ArchiveIcon from ' vue-material-design-icons/Archive.vue'
129+ import { getCurrentUser } from ' @nextcloud/auth'
130+ import { generateUrl } from ' @nextcloud/router'
131+
132+ import ' @nextcloud/dialogs/style.css'
92133
93134const capabilities = getCapabilities ()
94135
@@ -107,7 +148,7 @@ export default {
107148 AttachmentIcon,
108149 CommentIcon,
109150 HomeIcon,
110- CardMenuEntries ,
151+ ArchiveIcon ,
111152 },
112153 mixins: [relativeDate],
113154 props: {
@@ -139,8 +180,17 @@ export default {
139180 isFullApp : (state ) => state .isFullApp ,
140181 currentBoard : (state ) => state .currentBoard ,
141182 hasCardSaveError : (state ) => state .hasCardSaveError ,
183+ showArchived : (state ) => state .showArchived ,
142184 }),
143- ... mapGetters ([' canEdit' , ' assignables' , ' cardActions' , ' stackById' ]),
185+ ... mapGetters ([
186+ ' canEdit' ,
187+ ' assignables' ,
188+ ' cardActions' ,
189+ ' stackById' ,
190+ ' isArchived' ,
191+ ' boards' ,
192+ ' boardById' ,
193+ ]),
144194 currentCard () {
145195 return this .$store .getters .cardById (this .id )
146196 },
@@ -167,6 +217,31 @@ export default {
167217 return reference ? reference .openGraphObject .name : this .currentCard .title
168218 },
169219 },
220+ canEdit () {
221+ return ! this .currentCard .archived
222+ },
223+ canEditBoard () {
224+ if (this .currentBoard ) {
225+ return this .$store .getters .canEdit
226+ }
227+ const board = this .$store .getters .boards .find ((item ) => item .id === this .currentCard .boardId )
228+ return !! board? .permissions ? .PERMISSION_EDIT
229+ },
230+ isCurrentUserAssigned () {
231+ return this .currentCard .assignedUsers .find ((item ) => item .type === 0 && item .participant .uid === getCurrentUser ()? .uid )
232+ },
233+ boardId () {
234+ return this .card ? .boardId ? this .currentCard .boardId : Number (this .$route .params .id )
235+ },
236+ cardRichObject () {
237+ return {
238+ id: ' ' + this .currentCard .id ,
239+ name: this .currentCard .title ,
240+ boardname: this .boardById (this .boardId )? .title ,
241+ stackname: this .stackById (this .currentCard .stackId )? .title ,
242+ link: window .location .protocol + ' //' + window .location .host + generateUrl (' /apps/deck/' ) + ` card/${ this .currentCard .id } ` ,
243+ }
244+ },
170245 },
171246 watch: {
172247 currentCard () {
@@ -215,12 +290,46 @@ export default {
215290 formatDate (timestamp ) {
216291 return moment .unix (timestamp).locale (this .locale ).format (' LLLL' )
217292 },
293+ deleteCard () {
294+ this .$store .dispatch (' deleteCard' , this .currentCard )
295+ const undoCard = { ... this .currentCard , deletedAt: 0 }
296+ showUndo (t (' deck' , ' Card deleted' ), () => this .$store .dispatch (' cardUndoDelete' , undoCard))
297+ if (this .$router .currentRoute .name === ' card' ) {
298+ this .$router .push ({ name: ' board' })
299+ }
300+ },
301+ changeCardDoneStatus () {
302+ this .$store .dispatch (' changeCardDoneStatus' , { ... this .currentCard , done: ! this .currentCard .done })
303+ },
304+ archiveUnarchiveCard () {
305+ this .$store .dispatch (' archiveUnarchiveCard' , { ... this .currentCard , archived: ! this .currentCard .archived })
306+ },
307+ assignCardToMe () {
308+ this .$store .dispatch (' assignCardToUser' , {
309+ card: this .currentCard ,
310+ assignee: {
311+ userId: getCurrentUser ()? .uid ,
312+ type: 0 ,
313+ },
314+ })
315+ },
316+ unassignCardFromMe () {
317+ this .$store .dispatch (' removeUserFromCard' , {
318+ card: this .currentCard ,
319+ assignee: {
320+ userId: getCurrentUser ()? .uid ,
321+ type: 0 ,
322+ },
323+ })
324+ },
325+ openCardMoveDialog () {
326+ emit (' deck:card:show-move-dialog' , this .currentCard )
327+ },
218328 },
219329}
220330< / script>
221331
222332< style lang= " scss" >
223-
224333section .app - sidebar__tab-- active {
225334 min- height: auto;
226335 display: flex;
@@ -272,6 +381,7 @@ section.app-sidebar__tab--active {
272381 z- index: 100 ;
273382 background- color: var (-- color- main- background);
274383 }
384+
275385 .app - sidebar- tabs__nav {
276386 position: sticky;
277387 top: 87px ;
@@ -284,10 +394,10 @@ section.app-sidebar__tab--active {
284394 overflow: initial;
285395 }
286396
287- #emptycontent, .emptycontent {
397+ #emptycontent,
398+ .emptycontent {
288399 margin- top: 88px ;
289400 }
290401 }
291402}
292-
293403< / style>
0 commit comments