« 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/generateReleaseInfoContributionsLineWikiEditsPart.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateReleaseInfoContributionsLineWikiEditsPart.js')
-rw-r--r--src/content/dependencies/generateReleaseInfoContributionsLineWikiEditsPart.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/content/dependencies/generateReleaseInfoContributionsLineWikiEditsPart.js b/src/content/dependencies/generateReleaseInfoContributionsLineWikiEditsPart.js
new file mode 100644
index 00000000..37f29b1c
--- /dev/null
+++ b/src/content/dependencies/generateReleaseInfoContributionsLineWikiEditsPart.js
@@ -0,0 +1,52 @@
+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)),
+  }),
+
+  generate: (relations, {html, 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:
+              html.tags(
+                relations.contributionLinks.map(link =>
+                  language.$(capsule, 'editsLine', {
+                    artist:
+                      link.slots({
+                        showContribution: false,
+                        showExternalLinks: false,
+                        showChronology: false,
+                        preventTooltip: true,
+                      }),
+                  })),
+
+                {[html.joinChildren]: html.tag('br')}),
+          }),
+      })),
+};