diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-06-08 12:08:36 -0300 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-06-08 12:08:48 -0300 |
| commit | f10f5a187f26d08019e452e7fbd417b7f462faa4 (patch) | |
| tree | a721a9413b90b7c2dbd22d76b0ab212ed9219c7f /src/content/dependencies/generateContributionList.js | |
| parent | 6b858c651b55dc45ee5710c90389eb4b97069d54 (diff) | |
content, data: Track: Contributor Text preview
missing chronology link substitution
Diffstat (limited to 'src/content/dependencies/generateContributionList.js')
| -rw-r--r-- | src/content/dependencies/generateContributionList.js | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/src/content/dependencies/generateContributionList.js b/src/content/dependencies/generateContributionList.js index 4f68321f..4796cc02 100644 --- a/src/content/dependencies/generateContributionList.js +++ b/src/content/dependencies/generateContributionList.js @@ -1,30 +1,55 @@ export default { - relations: (relation, contributions) => ({ + relations: (relation, contributions, formatText) => ({ contributionLinks: contributions .map(contrib => relation('linkContribution', contrib)), + + formatText: + relation('transformContent', formatText), }), slots: { + attributes: {type: 'attributes', mutable: false}, + title: {type: 'html', mutable: false}, + chronologyKind: {type: 'string'}, }, - generate: (relations, slots, {html, language}) => - html.tag('ul', - {[html.onlyIfContent]: true}, - - relations.contributionLinks.length > 1 && - language.$order('misc.artistLink.withContribution', 0) === 'ARTIST' && - {class: 'offset-tooltips'}, - - relations.contributionLinks - .map(contributionLink => - html.tag('li', - contributionLink.slots({ - showAnnotation: true, - showExternalLinks: true, - showChronology: true, - preventWrapping: false, - chronologyKind: slots.chronologyKind, - })))), + generate(relations, slots, {html, language}) { + const {contributionLinks} = relations; + + for (const link of contributionLinks) { + link.setSlots({ + showAnnotation: true, + showExternalLinks: true, + showChronology: true, + preventWrapping: false, + chronologyKind: slots.chronologyKind, + }); + } + + if (!html.isBlank(relations.formatText)) { + return ( + html.tag('div', + slots.attributes, + relations.formatText.slot('mode', 'contributors')) + ); + } + + return html.tags([ + html.tag('p', + slots.attributes, + slots.title), + + html.tag('ul', + {[html.onlyIfContent]: true}, + + relations.contributionLinks.length > 1 && + language.$order('misc.artistLink.withContribution', 0) === 'ARTIST' && + {class: 'offset-tooltips'}, + + contributionLinks + .map(link => html.tag('li', link))) + ]); + } }; |