« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateContributionList.js20
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js16
2 files changed, 24 insertions, 12 deletions
diff --git a/src/content/dependencies/generateContributionList.js b/src/content/dependencies/generateContributionList.js
new file mode 100644
index 00000000..731cfba5
--- /dev/null
+++ b/src/content/dependencies/generateContributionList.js
@@ -0,0 +1,20 @@
+export default {
+  contentDependencies: ['linkContribution'],
+  extraDependencies: ['html'],
+
+  relations: (relation, contributions) =>
+    ({contributionLinks:
+        contributions
+          .map(contrib => relation('linkContribution', contrib))}),
+
+  generate: (relations, {html}) =>
+    html.tag('ul',
+      relations.contributionLinks.map(contributionLink =>
+        html.tag('li',
+          contributionLink
+            .slots({
+              showIcons: true,
+              showContribution: true,
+              preventWrapping: false,
+            })))),
+};
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index e02a2e3b..742f3902 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -16,6 +16,7 @@ export default {
     'generateAlbumStyleRules',
     'generateChronologyLinks',
     'generateContentHeading',
+    'generateContributionList',
     'generatePageLayout',
     'generateTrackCoverArtwork',
     'generateTrackList',
@@ -24,7 +25,6 @@ export default {
     'generateTrackSocialEmbed',
     'linkAlbum',
     'linkArtist',
-    'linkContribution',
     'linkFlash',
     'linkTrack',
     'transformContent',
@@ -149,9 +149,8 @@ export default {
       contributors.heading =
         relation('generateContentHeading');
 
-      contributors.contributionLinks =
-        track.contributorContribs
-          .map(contrib => relation('linkContribution', contrib));
+      contributors.list =
+        relation('generateContributionList', track.contributorContribs);
     }
 
     // Section: Referenced tracks
@@ -369,14 +368,7 @@ export default {
                 title: language.$('releaseInfo.contributors'),
               }),
 
-            html.tag('ul',
-              sec.contributors.contributionLinks.map(contributionLink =>
-                html.tag('li',
-                  contributionLink
-                    .slots({
-                      showIcons: true,
-                      showContribution: true,
-                    })))),
+            sec.contributors.list,
           ],
 
           sec.references && [