diff options
author | dartcafe <github@dartcafe.de> | 2021-01-03 15:50:05 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2021-01-03 15:50:05 +0300 |
commit | 7f923c9cf84a50cc54f9e0b311a6fdf3586f0843 (patch) | |
tree | a36af0ab201db6fb8a6d04262dafc5be423699e5 /src/js/components/Comments/Comments.vue | |
parent | 9e1510834f41ade0c22bb99637b7d0c4cc4972cc (diff) |
split comments
Diffstat (limited to 'src/js/components/Comments/Comments.vue')
-rw-r--r-- | src/js/components/Comments/Comments.vue | 61 |
1 files changed, 20 insertions, 41 deletions
diff --git a/src/js/components/Comments/Comments.vue b/src/js/components/Comments/Comments.vue index b32a621b..fbf9abe0 100644 --- a/src/js/components/Comments/Comments.vue +++ b/src/js/components/Comments/Comments.vue @@ -21,53 +21,40 @@ --> <template> - <div class="comments"> - <CommentAdd v-if="acl.allowComment" /> - <transition-group v-if="!showEmptyContent" name="fade" class="comments" - tag="ul"> - <li v-for="(comment) in sortedList" :key="comment.id"> - <div class="comment-item"> - <UserItem v-bind="comment" /> - <Actions v-if="comment.userId === acl.userId"> - <ActionButton icon="icon-delete" @click="deleteComment(comment)"> - {{ t('polls', 'Delete comment') }} - </ActionButton> - </Actions> - <div class="date"> - {{ dateCommentedRelative(comment.dt) }} - </div> + <transition-group name="fade" class="comments" + tag="ul"> + <li v-for="(comment) in sortedList" :key="comment.id"> + <div class="comment-item"> + <UserItem v-bind="comment" /> + <Actions v-if="comment.userId === acl.userId"> + <ActionButton icon="icon-delete" @click="deleteComment(comment)"> + {{ t('polls', 'Delete comment') }} + </ActionButton> + </Actions> + <div class="date"> + {{ dateCommentedRelative(comment.dt) }} </div> + </div> - <div class="message wordwrap comment-content"> - {{ comment.comment }} - </div> - </li> - </transition-group> - - <EmptyContent v-else icon="icon-comment"> - {{ t('polls', 'No comments') }} - <template #desc> - {{ t('polls', 'Be the first.') }} - </template> - </EmptyContent> - </div> + <div class="message wordwrap comment-content"> + {{ comment.comment }} + </div> + </li> + </transition-group> </template> <script> -import CommentAdd from './CommentAdd' import sortBy from 'lodash/sortBy' import moment from '@nextcloud/moment' import { showSuccess, showError } from '@nextcloud/dialogs' -import { Actions, ActionButton, EmptyContent } from '@nextcloud/vue' -import { mapState, mapGetters } from 'vuex' +import { Actions, ActionButton } from '@nextcloud/vue' +import { mapState } from 'vuex' export default { name: 'Comments', components: { Actions, ActionButton, - CommentAdd, - EmptyContent, }, data() { return { @@ -82,14 +69,6 @@ export default { acl: state => state.poll.acl, }), - ...mapGetters({ - countComments: 'poll/comments/count', - }), - - showEmptyContent() { - return this.countComments === 0 - }, - sortedList() { if (this.reverse) { return sortBy(this.comments, this.sort).reverse() |