-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathissue.bemtree.js
More file actions
104 lines (103 loc) · 3.65 KB
/
issue.bemtree.js
File metadata and controls
104 lines (103 loc) · 3.65 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
block('issue').content()((node, ctx) => {
const { block, i18n, data } = node;
const issue = ctx.issue;
const user = data.user || {};
const isPostPage = data.url.pathname.match(/\/\d+/);
return [
{
elem: 'header',
content: [
// TODO: maybe better to avoid element for one
// action and resolve it on actions level
issue.user.id === user.id && {
elem: 'actions',
content: [
{
block: 'button',
text: 'edit',
mix: { block, elem: 'edit-button' },
js: {
issueId: issue.number
}
},
{
block,
elem: 'toggle-resolved',
mix: { block: block, elem: 'actions-button' },
issue: {
number: issue.number,
state: issue.state
}
}
]
},
{
elem: 'date',
content: issue.created_from_now
},
{
elem: 'title',
content: [{
block: 'icon',
mods: { bg: 'check-circle' },
mix: [
{ block, elem: 'icon-resolved' },
{ block, elem: 'title-icon' }
]
}, {
block: 'link',
mix: { block, elem: 'header-link' },
url: '/' + issue.number + '/',
content: issue.title
}]
},
{
block: 'user',
mix: { block, elem: 'user' },
user: issue.user
},
issue.labels.length ? { block: 'labels-list', mods: { inline: true }, labels: issue.labels } : ''
]
},
{
elem: 'content',
content: [
{
block: 'md-body',
content: issue.html,
mix: { block, elem: 'content-body' }
},
{
block,
elem: 'bottom-content',
content: [
{
block: 'reaction',
reactions: issue.reactions,
js: {
blockType: block,
entityId: issue.number
}
},
{
block: 'button',
mods: {
disabled: isPostPage
},
mix: { block: 'issue', elem: 'comments-button' },
js: { number: issue.number },
text: issue.comments ? `${i18n('issue', 'comments')}: ${issue.comments}` : i18n('issue', 'leaveComment')
}
]
}
]
},
{
elem: 'footer',
content: !isPostPage ? '' : {
block: 'comments',
issueId: issue.number
}
}
];
});