2021-04-30 06:32:20 +00:00
|
|
|
<template>
|
2021-05-20 18:11:15 +00:00
|
|
|
<div class="card note-wrap">
|
2021-10-25 13:05:58 +00:00
|
|
|
<div class="header">
|
2021-04-30 06:32:20 +00:00
|
|
|
<div class="meta">
|
2021-10-25 13:05:58 +00:00
|
|
|
<thumbnail
|
|
|
|
:title="noteAuthorName"
|
|
|
|
:src="noteAuthor.thumbnail"
|
|
|
|
:username="noteAuthorName"
|
|
|
|
size="20px"
|
|
|
|
/>
|
2021-04-30 06:32:20 +00:00
|
|
|
<div class="date-wrap">
|
2021-10-25 13:05:58 +00:00
|
|
|
<span class="fw-medium"> {{ noteAuthorName }} </span>
|
|
|
|
<span> {{ $t('NOTES.LIST.LABEL') }} </span>
|
|
|
|
<span class="fw-medium"> {{ readableTime }} </span>
|
2021-04-30 06:32:20 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="actions">
|
|
|
|
<woot-button
|
2021-10-25 13:05:58 +00:00
|
|
|
v-tooltip="$t('NOTES.CONTENT_HEADER.DELETE')"
|
2021-06-09 08:31:43 +00:00
|
|
|
variant="smooth"
|
2021-06-09 12:55:05 +00:00
|
|
|
size="tiny"
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="delete"
|
2021-04-30 06:32:20 +00:00
|
|
|
color-scheme="secondary"
|
|
|
|
@click="onDelete"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-10-25 13:05:58 +00:00
|
|
|
<p class="note__content" v-html="formatMessage(note || '')" />
|
2021-04-30 06:32:20 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-06-09 12:55:05 +00:00
|
|
|
import Thumbnail from 'dashboard/components/widgets/Thumbnail';
|
2021-04-30 06:32:20 +00:00
|
|
|
import timeMixin from 'dashboard/mixins/time';
|
2021-10-25 13:05:58 +00:00
|
|
|
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
|
2021-04-30 06:32:20 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Thumbnail,
|
|
|
|
},
|
|
|
|
|
2021-10-25 13:05:58 +00:00
|
|
|
mixins: [timeMixin, messageFormatterMixin],
|
2021-04-30 06:32:20 +00:00
|
|
|
|
|
|
|
props: {
|
2021-05-05 08:06:45 +00:00
|
|
|
id: {
|
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
2021-04-30 06:32:20 +00:00
|
|
|
note: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2021-10-25 13:05:58 +00:00
|
|
|
user: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
2021-04-30 06:32:20 +00:00
|
|
|
},
|
2021-10-25 13:05:58 +00:00
|
|
|
createdAt: {
|
2021-04-30 06:32:20 +00:00
|
|
|
type: Number,
|
|
|
|
default: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
readableTime() {
|
2021-10-25 13:05:58 +00:00
|
|
|
return this.dynamicTime(this.createdAt);
|
|
|
|
},
|
|
|
|
noteAuthor() {
|
|
|
|
return this.user || {};
|
|
|
|
},
|
|
|
|
noteAuthorName() {
|
|
|
|
return this.noteAuthor.name || this.$t('APP_GLOBAL.DELETED_USER');
|
2021-04-30 06:32:20 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onDelete() {
|
2021-05-05 08:06:45 +00:00
|
|
|
this.$emit('delete', this.id);
|
2021-04-30 06:32:20 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-05-20 18:11:15 +00:00
|
|
|
.note__content {
|
2021-10-25 13:05:58 +00:00
|
|
|
margin-top: var(--space-normal);
|
2021-04-30 06:32:20 +00:00
|
|
|
}
|
|
|
|
|
2021-10-25 13:05:58 +00:00
|
|
|
.header {
|
2021-04-30 06:32:20 +00:00
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
2021-06-09 12:55:05 +00:00
|
|
|
align-items: flex-end;
|
2021-10-25 13:05:58 +00:00
|
|
|
font-size: var(--font-size-mini);
|
2021-04-30 06:32:20 +00:00
|
|
|
|
|
|
|
.meta {
|
|
|
|
display: flex;
|
2021-10-25 13:05:58 +00:00
|
|
|
align-items: center;
|
2021-04-30 06:32:20 +00:00
|
|
|
|
|
|
|
.date-wrap {
|
|
|
|
margin-left: var(--space-smaller);
|
|
|
|
padding: var(--space-micro);
|
|
|
|
color: var(--color-body);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.actions {
|
2021-05-20 18:11:15 +00:00
|
|
|
display: flex;
|
|
|
|
visibility: hidden;
|
|
|
|
|
2021-06-09 08:31:43 +00:00
|
|
|
.button {
|
|
|
|
margin-left: var(--space-small);
|
|
|
|
}
|
2021-04-30 06:32:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.note-wrap:hover {
|
|
|
|
.actions {
|
2021-05-20 18:11:15 +00:00
|
|
|
visibility: visible;
|
2021-04-30 06:32:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|