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
|
export default {
contentDependencies: ['linkAlbum', 'linkTrack'],
extraDependencies: ['html', 'language'],
relations: (relation, track) => ({
albumLink:
relation('linkAlbum', track.album),
trackLink:
relation('linkTrack', track),
}),
data: (track) => ({
hasTrackNumbers:
track.album.hasTrackNumbers,
trackNumber:
track.album.tracks.indexOf(track) + 1,
}),
slots: {
currentExtra: {
validate: v => v.is('referenced-art'),
},
},
generate: (data, relations, slots, {html, language}) =>
language.encapsulate('trackPage.nav', navCapsule => [
{auto: 'home'},
{html: relations.albumLink.slot('color', false)},
{
html:
language.encapsulate(navCapsule, 'track', workingCapsule => {
const workingOptions = {};
workingOptions.track =
relations.trackLink
.slot('attributes', {class: 'current'});
if (data.hasTrackNumbers) {
workingCapsule += '.withNumber';
workingOptions.number = data.trackNumber;
}
return language.$(workingCapsule, workingOptions);
}),
accent:
html.tag('a',
{[html.onlyIfContent]: true},
{href: ''},
{class: 'current'},
(slots.currentExtra === 'referenced-art'
? language.$(navCapsule, 'referencedArtworks')
: null)),
},
]),
};
|