--- a/src_js/iconolab-bundle/src/components/editor/CommentList.vue Mon Feb 20 18:33:36 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/editor/CommentList.vue Mon Feb 20 18:43:34 2017 +0100
@@ -1,7 +1,7 @@
<template>
<div v-show="comments.length > 0">
<label class="form-label">Commentaires</label>
- <comment ref="comments"
+ <comment
v-for="comment in comments"
v-bind:comment="comment.comment"
v-bind:username="comment.user_name"
@@ -14,6 +14,7 @@
import Comment from './Comment.vue'
export default {
+ props: ['annotation', 'fetch'],
components: {
Comment
},
@@ -22,6 +23,20 @@
'comments': []
}
},
+ computed: {
+ commentsURL: function() {
+ return this.fetch.replace(':annotation_guid', this.annotation.annotation_guid);
+ }
+ },
+ watch: {
+ annotation: function(annotation) {
+ if (annotation) {
+ $.getJSON(this.commentsURL).then((comments) => this.comments = comments);
+ } else {
+ this.comments = [];
+ }
+ }
+ }
}
</script>