Merge pull request #1973 from Human-Connection/1970-hide-new-comment-form-while-editing-other-comments

Hide new CommentForm while editing a comment
This commit is contained in:
mattwr18 2019-10-22 11:01:31 +02:00 committed by GitHub
commit d87f9c8a1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -149,6 +149,7 @@ export default {
},
editCommentMenu(showMenu) {
this.openEditCommentMenu = showMenu
this.$emit('toggleNewCommentForm', !showMenu)
},
updateComment(comment) {
this.$emit('updateComment', comment)

View File

@ -25,6 +25,7 @@
:routeHash="routeHash"
@deleteComment="updateCommentList"
@updateComment="updateCommentList"
@toggleNewCommentForm="toggleNewCommentForm"
/>
</div>
</div>
@ -51,6 +52,9 @@ export default {
return comment.id === updatedComment.id ? updatedComment : comment
})
},
toggleNewCommentForm(showNewCommentForm) {
this.$emit('toggleNewCommentForm', showNewCommentForm)
},
},
}
</script>

View File

@ -70,9 +70,13 @@
</ds-space>
<!-- Comments -->
<ds-section slot="footer">
<hc-comment-list :post="post" :routeHash="$route.hash" />
<hc-comment-list
:post="post"
:routeHash="$route.hash"
@toggleNewCommentForm="toggleNewCommentForm"
/>
<ds-space margin-bottom="large" />
<hc-comment-form :post="post" @createComment="createComment" />
<hc-comment-form v-if="showNewCommentForm" :post="post" @createComment="createComment" />
</ds-section>
</ds-card>
</transition>
@ -119,6 +123,7 @@ export default {
post: null,
ready: false,
title: 'loading',
showNewCommentForm: true,
}
},
watch: {
@ -181,6 +186,9 @@ export default {
})
.catch(error => this.$toast.error(error.message))
},
toggleNewCommentForm(showNewCommentForm) {
this.showNewCommentForm = showNewCommentForm
},
},
apollo: {
Post: {