diff options
Diffstat (limited to 'src/content/dependencies/generateArtistCreditWikiEditsPart.js')
-rw-r--r-- | src/content/dependencies/generateArtistCreditWikiEditsPart.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/content/dependencies/generateArtistCreditWikiEditsPart.js b/src/content/dependencies/generateArtistCreditWikiEditsPart.js new file mode 100644 index 00000000..70296e39 --- /dev/null +++ b/src/content/dependencies/generateArtistCreditWikiEditsPart.js @@ -0,0 +1,55 @@ +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)), + }), + + slots: { + showAnnotation: {type: 'boolean', default: true}, + }, + + generate: (relations, slots, {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: + language.$(capsule, 'editsLine', { + [language.onlyIfOptions]: ['artists'], + + artists: + language.formatConjunctionList( + relations.contributionLinks.map(link => + link.slots({ + showAnnotation: slots.showAnnotation, + trimAnnotation: true, + preventTooltip: true, + }))), + }), + }), + })), +}; |