« get me outta code hell

generateCoverArtworkOriginDetails.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/generateCoverArtworkOriginDetails.js
blob: 8b5a28ac41b601e0f5c089d3e02b6d1b89d55619 (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
export default {
  contentDependencies: ['generateArtistCredit'],
  extraDependencies: ['html', 'language'],

  relations: (relation, artwork) => ({
    credit:
      relation('generateArtistCredit', artwork.artistContribs, []),
  }),

  data: (artwork) => ({
    date:
      (artwork.date !== artwork.thing.date
        ? artwork.date
        : null),
  }),

  generate: (data, relations, {html, language}) =>
    language.encapsulate('misc.coverArtwork', capsule =>
      html.tag('p', {class: 'image-details'},
        {[html.onlyIfContent]: true},
        {[html.joinChildren]: html.tag('br')},

        {class: 'origin-details'},

        [
          relations.credit.slots({
            showAnnotation: true,
            showExternalLinks: true,
            showChronology: true,
            showWikiEdits: true,

            trimAnnotation: false,

            chronologyKind: 'coverArt',

            normalStringKey: capsule + '.artworkBy',
          }),

          language.$(capsule, 'released', {
            [language.onlyIfOptions]: ['date'],
            date: language.formatDate(data.date),
          })
        ])),
};