Do not display comment box when not authenticated.
--- a/src/iconolab/templates/iconolab/detail_image.html Tue Mar 14 12:54:51 2017 +0100
+++ b/src/iconolab/templates/iconolab/detail_image.html Tue Mar 14 13:07:45 2017 +0100
@@ -48,11 +48,12 @@
{% csrf_token %}
</annotation-form>
<div class="annotation-comment-box" id="form-comment">
- <comment-form v-if="annotation"></comment-form>
+ <comment-form v-if="annotation && isAuthenticated"></comment-form>
</div>
<div v-show="annotation" class="annotation-comment-list">
<label class="small text-muted">Commentaires</label>
<comment-list v-bind:annotation="annotation"
+ v-bind:is-authenticated="isAuthenticated"
fetch="{% url 'get_annotation_comments_json' ':annotation_guid' %}"></comment-list>
</div>
</div>
--- a/src_js/iconolab-bundle/src/components/editor/Comment.vue Tue Mar 14 12:54:51 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/editor/Comment.vue Tue Mar 14 13:07:45 2017 +0100
@@ -7,9 +7,8 @@
<div class="comment-footer">
<span class="comment-date">{{ dateFormatted }}</span>
</div>
-
<comment-form v-show="hover"
- v-if="allowThread"
+ v-if="allowThread && isAuthenticated"
v-bind:annotation="annotation"
v-bind:reply-to="id">
</comment-form>
@@ -34,7 +33,8 @@
'username',
'email',
'date',
- 'allowThread'
+ 'allow-thread',
+ 'is-authenticated'
],
data() {
return {
--- a/src_js/iconolab-bundle/src/components/editor/CommentList.vue Tue Mar 14 12:54:51 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/editor/CommentList.vue Tue Mar 14 13:07:45 2017 +0100
@@ -8,7 +8,8 @@
v-bind:comment="comment.comment"
v-bind:username="comment.user_name"
v-bind:date="comment.submit_date"
- v-bind:allowThread="comment.allow_thread"></comment>
+ v-bind:allow-thread="comment.allow_thread"
+ v-bind:is-authenticated="isAuthenticated"></comment>
</div>
</template>
@@ -17,7 +18,7 @@
import Comment from './Comment.vue'
export default {
- props: ['annotation', 'fetch'],
+ props: ['annotation', 'fetch', 'is-authenticated'],
components: {
Comment
},
@@ -39,6 +40,11 @@
this.comments = [];
}
}
+ },
+ mounted() {
+ if (this.annotation) {
+ $.getJSON(this.commentsURL).then((comments) => this.comments = comments);
+ }
}
}
@@ -46,9 +52,9 @@
<style scoped>
.wrapper {
- /* max-height: 200px; */
height: auto;
overflow-y: auto;
+ margin-bottom: 20px;
}
.alert {
padding: 10px;