Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/components/Comments/Comments.vue')
-rw-r--r--src/js/components/Comments/Comments.vue26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/js/components/Comments/Comments.vue b/src/js/components/Comments/Comments.vue
index 9c43ffa8..24f118bb 100644
--- a/src/js/components/Comments/Comments.vue
+++ b/src/js/components/Comments/Comments.vue
@@ -29,15 +29,22 @@
<li v-for="(comment) in sortedList" :key="comment.id">
<div class="comment-item">
<user-div :user-id="comment.userId" />
+ <Actions v-if="comment.userId === acl.userId">
+ <ActionButton icon="icon-delete" @click="deleteComment(comment)">
+ {{ t('polls', 'Delete comment') }}
+ </ActionButton>
+ </Actions>
<div class="date">
{{ moment.utc(comment.dt).fromNow() }}
</div>
</div>
+
<div class="message wordwrap comment-content">
{{ comment.comment }}
</div>
</li>
</transition-group>
+
<div v-else class="emptycontent">
<div class="icon-comment" />
<p> {{ t('polls', 'No comments yet. Be the first.') }}</p>
@@ -47,12 +54,15 @@
<script>
import CommentAdd from './CommentAdd'
-import { mapState, mapGetters } from 'vuex'
import sortBy from 'lodash/sortBy'
+import { Actions, ActionButton } from '@nextcloud/vue'
+import { mapState, mapGetters } from 'vuex'
export default {
name: 'Comments',
components: {
+ Actions,
+ ActionButton,
CommentAdd
},
data() {
@@ -80,6 +90,18 @@ export default {
}
}
+ },
+
+ methods: {
+ deleteComment(comment) {
+ this.$store.dispatch({ type: 'deleteComment', comment: comment })
+ .then(() => {
+ OC.Notification.showTemporary(t('polls', 'Comment deleted'), { type: 'success' })
+ }, (error) => {
+ OC.Notification.showTemporary(t('polls', 'Error while deleting Comment'), { type: 'error' })
+ console.error(error.response)
+ })
+ }
}
}
</script>
@@ -108,7 +130,7 @@ ul {
}
}
& > .message {
- margin-left: 44px;
+ margin-left: 53px;
flex: 1 1;
}
}