« 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/dependencies/linkContribution.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/linkContribution.js')
-rw-r--r--src/content/dependencies/linkContribution.js71
1 files changed, 31 insertions, 40 deletions
diff --git a/src/content/dependencies/linkContribution.js b/src/content/dependencies/linkContribution.js
index 1d0e2d6a..cc0cb353 100644
--- a/src/content/dependencies/linkContribution.js
+++ b/src/content/dependencies/linkContribution.js
@@ -27,48 +27,39 @@ export default {
     return {contribution};
   },
 
-  generate(data, relations, {
-    html,
-    language,
-  }) {
-    return html.template({
-      annotation: 'linkContribution',
-
-      slots: {
-        showContribution: {type: 'boolean', default: false},
-        showIcons: {type: 'boolean', default: false},
-      },
+  slots: {
+    showContribution: {type: 'boolean', default: false},
+    showIcons: {type: 'boolean', default: false},
+  },
 
-      content(slots) {
-        const hasContributionPart = !!(slots.showContribution && data.contribution);
-        const hasExternalPart = !!(slots.showIcons && !empty(relations.artistIcons));
+  generate(data, relations, slots, {html, language}) {
+    const hasContributionPart = !!(slots.showContribution && data.contribution);
+    const hasExternalPart = !!(slots.showIcons && !empty(relations.artistIcons));
 
-        const externalLinks = hasExternalPart &&
-          html.tag('span',
-            {[html.noEdgeWhitespace]: true, class: 'icons'},
-            language.formatUnitList(relations.artistIcons));
+    const externalLinks = hasExternalPart &&
+      html.tag('span',
+        {[html.noEdgeWhitespace]: true, class: 'icons'},
+        language.formatUnitList(relations.artistIcons));
 
-        return (
-          (hasContributionPart
-            ? (hasExternalPart
-                ? language.$('misc.artistLink.withContribution.withExternalLinks', {
-                    artist: relations.artistLink,
-                    contrib: data.contribution,
-                    links: externalLinks,
-                  })
-                : language.$('misc.artistLink.withContribution', {
-                    artist: relations.artistLink,
-                    contrib: data.contribution,
-                  }))
-            : (hasExternalPart
-                ? language.$('misc.artistLink.withExternalLinks', {
-                    artist: relations.artistLink,
-                    links: externalLinks,
-                  })
-                : language.$('misc.artistLink', {
-                    artist: relations.artistLink,
-                  }))));
-      },
-    });
+    return (
+      (hasContributionPart
+        ? (hasExternalPart
+            ? language.$('misc.artistLink.withContribution.withExternalLinks', {
+                artist: relations.artistLink,
+                contrib: data.contribution,
+                links: externalLinks,
+              })
+            : language.$('misc.artistLink.withContribution', {
+                artist: relations.artistLink,
+                contrib: data.contribution,
+              }))
+        : (hasExternalPart
+            ? language.$('misc.artistLink.withExternalLinks', {
+                artist: relations.artistLink,
+                links: externalLinks,
+              })
+            : language.$('misc.artistLink', {
+                artist: relations.artistLink,
+              }))));
   },
 };