« get me outta code hell

generateReleaseInfoContributionsLineWikiEditsPart.js « dependencies « content « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateReleaseInfoContributionsLineWikiEditsPart.js
blob: c5c52fa0f7d2d8ce6741980603c1fb770ad99a27 (plain)
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
export default {
  contentDependencies: [
    'generateTextWithTooltip',
    'generateTooltip',
    'linkContribution',
  ],

  extraDependencies: ['html', 'language'],

  relations: (relation, contributions) => ({
    textWithTooltip:
      relation('generateTextWithTooltip'),

    tooltip:
      relation('generateTooltip'),

    contributionLinks:
      contributions
        .map(contrib => relation('linkContribution', contrib)),
  }),

  generate: (relations, {html, language}) =>
    language.encapsulate('misc.artistLink.withEditsForWiki', capsule =>
      relations.textWithTooltip.slots({
        attributes:
          {class: 'wiki-edits'},

        text:
          language.$(capsule, 'edits'),

        tooltip:
          relations.tooltip.slots({
            attributes:
              {class: 'wiki-edits-tooltip'},

            content:
              html.tags(
                relations.contributionLinks.map(link =>
                  language.$(capsule, 'editsLine', {
                    artist:
                      link.slots({
                        showAnnotation: true,
                        trimAnnotation: true,
                        preventTooltip: true,
                      }),
                  })),

                {[html.joinChildren]: html.tag('br')}),
          }),
      })),
};