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
|
export default {
contentDependencies: ['linkAnythingMan'],
extraDependencies: ['html', 'language'],
query(contribution) {
let previous = contribution;
while (previous && previous.thing === contribution.thing) {
previous = previous.previousBySameArtist;
}
let next = contribution;
while (next && next.thing === contribution.thing) {
next = next.nextBySameArtist;
}
return {previous, next};
},
relations: (relation, query, _contribution) => ({
previousLink:
(query.previous
? relation('linkAnythingMan', query.previous.thing)
: null),
nextLink:
(query.next
? relation('linkAnythingMan', query.next.thing)
: null),
}),
generate: (relations, {html, language}) =>
language.encapsulate('misc.artistLink.chronology', capsule =>
html.tags([
html.tag('span', {class: 'chronology-link'},
{[html.onlyIfContent]: true},
language.$(capsule, 'previous', {
[language.onlyIfOptions]: ['thing'],
thing: relations.previousLink,
})),
html.tag('span', {class: 'chronology-link'},
{[html.onlyIfContent]: true},
language.$(capsule, 'next', {
[language.onlyIfOptions]: ['thing'],
thing: relations.nextLink,
})),
])),
};
|