2018-03-17 18:26:18 +05:30
|
|
|
<script>
|
2018-05-09 12:01:36 +05:30
|
|
|
import { mapActions } from 'vuex';
|
|
|
|
import timeAgoTooltip from '../../vue_shared/components/time_ago_tooltip.vue';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
timeAgoTooltip,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
author: {
|
|
|
|
type: Object,
|
2018-11-20 20:47:30 +05:30
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
createdAt: {
|
|
|
|
type: String,
|
2018-12-05 23:21:45 +05:30
|
|
|
required: false,
|
|
|
|
default: null,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
actionText: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
noteId: {
|
2018-12-05 23:21:45 +05:30
|
|
|
type: [String, Number],
|
|
|
|
required: false,
|
|
|
|
default: null,
|
2018-05-09 12:01:36 +05:30
|
|
|
},
|
|
|
|
includeToggle: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
expanded: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
toggleChevronClass() {
|
|
|
|
return this.expanded ? 'fa-chevron-up' : 'fa-chevron-down';
|
|
|
|
},
|
|
|
|
noteTimestampLink() {
|
|
|
|
return `#note_${this.noteId}`;
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
hasAuthor() {
|
|
|
|
return this.author && Object.keys(this.author).length;
|
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(['setTargetNoteHash']),
|
|
|
|
handleToggle() {
|
|
|
|
this.$emit('toggleHandler');
|
|
|
|
},
|
|
|
|
updateTargetNoteHash() {
|
|
|
|
this.setTargetNoteHash(this.noteTimestampLink);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2018-03-17 18:26:18 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="note-header-info">
|
2019-01-03 12:48:30 +05:30
|
|
|
<div
|
|
|
|
v-if="includeToggle"
|
|
|
|
class="discussion-actions">
|
2018-11-08 19:23:39 +05:30
|
|
|
<button
|
|
|
|
class="note-action-button discussion-toggle-button js-vue-toggle-button"
|
|
|
|
type="button"
|
2019-01-03 12:48:30 +05:30
|
|
|
@click="handleToggle">
|
|
|
|
<i
|
|
|
|
:class="toggleChevronClass"
|
|
|
|
class="fa"
|
|
|
|
aria-hidden="true">
|
|
|
|
</i>
|
2018-11-08 19:23:39 +05:30
|
|
|
{{ __('Toggle discussion') }}
|
|
|
|
</button>
|
|
|
|
</div>
|
2018-11-20 20:47:30 +05:30
|
|
|
<a
|
2018-12-13 13:39:08 +05:30
|
|
|
v-if="hasAuthor"
|
2018-11-20 20:47:30 +05:30
|
|
|
:href="author.path"
|
|
|
|
>
|
2018-03-17 18:26:18 +05:30
|
|
|
<span class="note-header-author-name">{{ author.name }}</span>
|
2019-01-03 12:48:30 +05:30
|
|
|
<span
|
|
|
|
v-if="author.status_tooltip_html"
|
|
|
|
v-html="author.status_tooltip_html"></span>
|
|
|
|
<span class="note-headline-light">
|
|
|
|
@{{ author.username }}
|
|
|
|
</span>
|
2018-03-17 18:26:18 +05:30
|
|
|
</a>
|
2019-01-03 12:48:30 +05:30
|
|
|
<span v-else>
|
|
|
|
{{ __('A deleted user') }}
|
|
|
|
</span>
|
2018-03-17 18:26:18 +05:30
|
|
|
<span class="note-headline-light">
|
|
|
|
<span class="note-headline-meta">
|
2019-01-03 12:48:30 +05:30
|
|
|
<span class="system-note-message">
|
|
|
|
<slot></slot>
|
|
|
|
</span>
|
|
|
|
<template
|
|
|
|
v-if="createdAt"
|
|
|
|
>
|
2018-12-05 23:21:45 +05:30
|
|
|
<span class="system-note-separator">
|
2018-12-13 13:39:08 +05:30
|
|
|
<template v-if="actionText">
|
|
|
|
{{ actionText }}
|
|
|
|
</template>
|
2018-12-05 23:21:45 +05:30
|
|
|
</span>
|
|
|
|
<a
|
|
|
|
:href="noteTimestampLink"
|
|
|
|
class="note-timestamp system-note-separator"
|
2019-01-03 12:48:30 +05:30
|
|
|
@click="updateTargetNoteHash">
|
|
|
|
<time-ago-tooltip
|
|
|
|
:time="createdAt"
|
|
|
|
tooltip-placement="bottom"
|
|
|
|
/>
|
2018-12-05 23:21:45 +05:30
|
|
|
</a>
|
|
|
|
</template>
|
2018-03-17 18:26:18 +05:30
|
|
|
<i
|
|
|
|
class="fa fa-spinner fa-spin editing-spinner"
|
|
|
|
aria-label="Comment is being updated"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
</i>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</template>
|