2023-12-12 19:17:38 +08:00
|
|
|
<template>
|
2024-02-28 20:31:42 +08:00
|
|
|
<span v-if="!params.data.permissions.create_comments && params.data.comments.count === 0">0</span>
|
2023-12-12 19:17:38 +08:00
|
|
|
<a v-else
|
|
|
|
href="#"
|
|
|
|
class="open-comments-sidebar" tabindex=0 :id="'comment-count-' + params.data.id"
|
2024-02-28 20:31:42 +08:00
|
|
|
:data-object-type="objectType" :data-object-id="params.data.id">
|
2023-12-12 19:17:38 +08:00
|
|
|
<template v-if="params.data.comments.count > 0">
|
|
|
|
{{ params.data.comments.count }}
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
+
|
|
|
|
</template>
|
2024-02-27 00:43:07 +08:00
|
|
|
<span v-if="params.data.comments.count_unseen > 0"
|
2024-02-28 18:27:29 +08:00
|
|
|
class="unseen-comments inline-flex align-super text-xs font-semibold rounded-full bg-sn-science-blue text-sn-white w-3.5 h-3.5 items-center justify-center">
|
2023-12-12 19:17:38 +08:00
|
|
|
{{params.data.comments.count_unseen }}
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'CommentsRenderer',
|
|
|
|
props: {
|
|
|
|
params: {
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
2024-02-28 20:31:42 +08:00
|
|
|
computed: {
|
|
|
|
objectType() {
|
|
|
|
switch (this.params.data.type) {
|
|
|
|
case 'my_modules':
|
|
|
|
return 'MyModule';
|
|
|
|
case 'projects':
|
|
|
|
return 'Project';
|
|
|
|
default:
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-12-12 19:17:38 +08:00
|
|
|
methods: {
|
|
|
|
openModal() {
|
|
|
|
this.params.dtComponent.$emit('openComments', null, [this.params.data]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|