| 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
 | export default {
  contentDependencies: [
    'generateAbsoluteDatetimestamp',
    'generateRelativeDatetimestamp',
    'linkNewsEntry',
  ],
  extraDependencies: ['html', 'language'],
  relations(relation, currentEntry, previousEntry, nextEntry) {
    const relations = {};
    if (previousEntry) {
      relations.previousEntryLink =
        relation('linkNewsEntry', previousEntry);
      if (previousEntry.date) {
        relations.previousEntryDatetimestamp =
          (currentEntry.date
            ? relation('generateRelativeDatetimestamp',
                previousEntry.date,
                currentEntry.date)
            : relation('generateAbsoluteDatetimestamp',
                previousEntry.date));
      }
    }
    if (nextEntry) {
      relations.nextEntryLink =
        relation('linkNewsEntry', nextEntry);
      if (nextEntry.date) {
        relations.nextEntryDatetimestamp =
          (currentEntry.date
            ? relation('generateRelativeDatetimestamp',
                nextEntry.date,
                currentEntry.date)
            : relation('generateAbsoluteDatetimestamp',
                nextEntry.date));
      }
    }
    return relations;
  },
  generate(relations, {html, language}) {
    const prefix = `newsEntryPage.readAnother`;
    const entryLines = [];
    if (relations.previousEntryLink) {
      const parts = [prefix, `previous`];
      const options = {};
      options.entry = relations.previousEntryLink;
      if (relations.previousEntryDatetimestamp) {
        parts.push('withDate');
        options.date =
          relations.previousEntryDatetimestamp.slots({
            style: 'full',
            tooltip: true,
          });
      }
      entryLines.push(language.$(...parts, options));
    }
    if (relations.nextEntryLink) {
      const parts = [prefix, `next`];
      const options = {};
      options.entry = relations.nextEntryLink;
      if (relations.nextEntryDatetimestamp) {
        parts.push('withDate');
        options.date =
          relations.nextEntryDatetimestamp.slots({
            style: 'full',
            tooltip: true,
          });
      }
      entryLines.push(language.$(...parts, options));
    }
    return (
      html.tag('p', {
        [html.onlyIfContent]: true,
        [html.joinChildren]: html.tag('br'),
        class: [
          'read-another-links',
          entryLines.length > 1 && 'offset-tooltips',
        ],
      }, entryLines));
  },
};
 |