Allow to cancel repies and adapt comment ui to talk
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -7,7 +7,11 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CommentItem v-if="replyTo" :comment="replyTo" :reply="true" />
|
<CommentItem v-if="replyTo"
|
||||||
|
:comment="replyTo"
|
||||||
|
:reply="true"
|
||||||
|
:preview="true"
|
||||||
|
@cancel="cancelReply" />
|
||||||
<CommentForm v-model="newComment" @submit="createComment" />
|
<CommentForm v-model="newComment" @submit="createComment" />
|
||||||
|
|
||||||
<ul v-if="getCommentsForCard(card.id).length > 0" id="commentsFeed">
|
<ul v-if="getCommentsForCard(card.id).length > 0" id="commentsFeed">
|
||||||
@@ -36,6 +40,7 @@ import CommentItem from './CommentItem'
|
|||||||
import CommentForm from './CommentForm'
|
import CommentForm from './CommentForm'
|
||||||
import InfiniteLoading from 'vue-infinite-loading'
|
import InfiniteLoading from 'vue-infinite-loading'
|
||||||
import { getCurrentUser } from '@nextcloud/auth'
|
import { getCurrentUser } from '@nextcloud/auth'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CardSidebarTabComments',
|
name: 'CardSidebarTabComments',
|
||||||
components: {
|
components: {
|
||||||
@@ -101,6 +106,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async loadComments() {
|
async loadComments() {
|
||||||
|
this.$store.dispatch('setReplyTo', null)
|
||||||
this.error = null
|
this.error = null
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
try {
|
try {
|
||||||
@@ -130,6 +136,9 @@ export default {
|
|||||||
await this.$store.dispatch('fetchMore', { cardId: this.card.id })
|
await this.$store.dispatch('fetchMore', { cardId: this.card.id })
|
||||||
this.isLoading = false
|
this.isLoading = false
|
||||||
},
|
},
|
||||||
|
cancelReply() {
|
||||||
|
this.$store.dispatch('setReplyTo', null)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ export default {
|
|||||||
|
|
||||||
.comment-form__contenteditable {
|
.comment-form__contenteditable {
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
|
border-radius: var(--border-radius-large)
|
||||||
}
|
}
|
||||||
|
|
||||||
.atwho-wrap {
|
.atwho-wrap {
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="reply" class="reply">
|
<div v-if="reply" class="reply" :class="{ 'reply--preview': preview }">
|
||||||
<span class="reply--hint">{{ t('deck', 'In reply to') }} <UserBubble :user="comment.actorId" :display-name="comment.actorDisplayName" /></span>
|
<div class="reply--wrapper">
|
||||||
<RichText class="comment--content"
|
<div class="reply--header">
|
||||||
:text="richText(comment)"
|
<div class="reply--hint">
|
||||||
:arguments="richArgs(comment)"
|
{{ t('deck', 'In reply to') }}
|
||||||
:autolink="true" />
|
<UserBubble :user="comment.actorId" :display-name="comment.actorDisplayName" />
|
||||||
|
</div>
|
||||||
|
<Actions v-if="preview" class="reply--cancel">
|
||||||
|
<ActionButton icon="icon-close" @click="$emit('cancel')">
|
||||||
|
{{ t('deck', 'Cancel reply') }}
|
||||||
|
</ActionButton>
|
||||||
|
</Actions>
|
||||||
|
</div>
|
||||||
|
<RichText class="comment--content"
|
||||||
|
:text="richText(comment)"
|
||||||
|
:arguments="richArgs(comment)"
|
||||||
|
:autolink="true" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<li v-else class="comment">
|
<li v-else class="comment">
|
||||||
<template>
|
<template>
|
||||||
@@ -14,13 +26,19 @@
|
|||||||
{{ comment.actorDisplayName }}
|
{{ comment.actorDisplayName }}
|
||||||
</span>
|
</span>
|
||||||
<Actions v-show="!edit" :force-menu="true">
|
<Actions v-show="!edit" :force-menu="true">
|
||||||
<ActionButton icon="icon-reply" @click="replyTo()">
|
<ActionButton icon="icon-reply" :close-after-click="true" @click="replyTo()">
|
||||||
{{ t('deck', 'Reply') }}
|
{{ t('deck', 'Reply') }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
<ActionButton v-if="canEdit" icon="icon-rename" @click="showUpdateForm()">
|
<ActionButton v-if="canEdit"
|
||||||
|
icon="icon-rename"
|
||||||
|
:close-after-click="true"
|
||||||
|
@click="showUpdateForm()">
|
||||||
{{ t('deck', 'Update') }}
|
{{ t('deck', 'Update') }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
<ActionButton v-if="canEdit" icon="icon-delete" @click="deleteComment()">
|
<ActionButton v-if="canEdit"
|
||||||
|
icon="icon-delete"
|
||||||
|
:close-after-click="true"
|
||||||
|
@click="deleteComment()">
|
||||||
{{ t('deck', 'Delete') }}
|
{{ t('deck', 'Delete') }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</Actions>
|
</Actions>
|
||||||
@@ -86,6 +104,10 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
preview: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -175,20 +197,41 @@ export default {
|
|||||||
@import '../../css/comments';
|
@import '../../css/comments';
|
||||||
|
|
||||||
.reply {
|
.reply {
|
||||||
border-left: 3px solid var(--color-primary-element);
|
margin: 0 0 0 44px;
|
||||||
padding-left: 5px;
|
|
||||||
margin-left: 2px;
|
&.reply--preview {
|
||||||
margin-bottom: 5px;
|
margin: 4px 0;
|
||||||
|
padding: 8px;
|
||||||
|
background-color: var(--color-background-hover);
|
||||||
|
border-radius: var(--border-radius-large);
|
||||||
|
|
||||||
|
.reply--wrapper {
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reply--cancel {
|
||||||
|
margin-right: -12px;
|
||||||
|
margin-top: -12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.reply--wrapper {
|
||||||
|
border-left: 4px solid var(--color-border-dark);
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
&::v-deep .rich-text--wrapper {
|
&::v-deep .rich-text--wrapper {
|
||||||
margin-top: -3px;
|
margin-top: -3px;
|
||||||
color: var(--color-text-light);
|
color: var(--color-text-lighter);
|
||||||
|
}
|
||||||
|
|
||||||
|
.reply--header {
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reply--hint {
|
.reply--hint {
|
||||||
font-size: 0.9em;
|
|
||||||
color: var(--color-text-lighter);
|
color: var(--color-text-lighter);
|
||||||
vertical-align: top;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment--content {
|
.comment--content {
|
||||||
|
|||||||
Reference in New Issue
Block a user