1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
<script>
import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue';
import IssueNoteHeader from './issue_note_header.vue';
import IssueNoteActions from './issue_note_actions.vue';
import IssueNoteBody from './issue_note_body.vue';
export default {
props: {
note: {
type: Object,
required: true,
},
},
data() {
return {
isEditing: false,
}
},
components: {
UserAvatarLink,
IssueNoteHeader,
IssueNoteActions,
IssueNoteBody,
},
computed: {
author() {
return this.note.author;
},
},
methods: {
editHandler() {
this.isEditing = true;
},
formUpdateHandler(data) {
console.log('update requested', data);
},
formCancelHandler() {
this.isEditing = false;
},
},
};
</script>
<template>
<li
class="note timeline-entry"
:class="{ 'is-editing': isEditing }">
<div class="timeline-entry-inner">
<div class="timeline-icon">
<user-avatar-link
:link-href="author.path"
:img-src="author.avatar_url"
:img-alt="author.name"
:img-size="40" />
</div>
<div class="timeline-content">
<div class="note-header">
<issue-note-header
:author="author"
:createdAt="note.created_at"
:notePath="note.path"
actionText="commented" />
<issue-note-actions
:accessLevel="note.human_access"
:canAward="note.emoji_awardable"
:canEdit="note.can_edit"
:canDelete="note.can_edit"
:reportAbusePath="note.report_abuse_path"
:editHandler="editHandler" />
</div>
<issue-note-body
:note="note"
:isEditing="isEditing"
:formUpdateHandler="formUpdateHandler"
:formCancelHandler="formCancelHandler" />
</div>
</div>
</li>
</template>
|