« get me outta code hell

content: gGIPAlbumsListItem: group-disconnected albums - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-11-02 23:08:33 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-11-02 23:08:33 -0300
commit4793c04918a62189c040c7aade490f7a9a8b8b36 (patch)
tree6456e00f6ce79cedc3280a3ecba5a9a4dad2eef4 /src
parent4ce3e7afbc99cc4a6efe9b63a4b53cde6384cde7 (diff)
content: gGIPAlbumsListItem: group-disconnected albums
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListItem.js29
-rw-r--r--src/strings-default.yaml1
2 files changed, 27 insertions, 3 deletions
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js b/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
index f0e1e39c..99e7e8ff 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListItem.js
@@ -24,7 +24,7 @@ export default {
     return {otherGroups};
   },
 
-  relations: (relation, query, album) => ({
+  relations: (relation, query, album, _group) => ({
     colorStyle:
       relation('generateColorStyleAttribute', album.color),
 
@@ -44,13 +44,21 @@ export default {
         .map(group => relation('linkGroup', group)),
   }),
 
+  data: (_query, album, group) => ({
+    groupName:
+      group.name,
+
+    notFromThisGroup:
+      !group.albums.includes(album),
+  }),
+
   slots: {
     accentMode: {
       validate: v => v.is('groups', 'artists'),
     },
   },
 
-  generate: (relations, slots, {html, language}) =>
+  generate: (data, relations, slots, {html, language}) =>
     html.tag('li',
       relations.colorStyle,
 
@@ -74,7 +82,22 @@ export default {
 
           const otherGroupCapsule = language.encapsulate(itemCapsule, 'withOtherGroup');
 
-          if (slots.accentMode === 'groups' && !empty(relations.otherGroupLinks)) {
+          if (
+            (slots.accentMode === 'groups' ||
+             slots.accentMode === null) &&
+            data.notFromThisGroup
+          ) {
+            workingCapsule += '.withOtherGroup';
+            workingOptions.otherGroupAccent =
+              html.tag('span', {class: 'other-group-accent'},
+                language.$(otherGroupCapsule, 'notFromThisGroup', {
+                  group:
+                    data.groupName,
+                }));
+          } else if (
+            slots.accentMode === 'groups' &&
+            !empty(relations.otherGroupLinks)
+          ) {
             workingCapsule += '.withOtherGroup';
             workingOptions.otherGroupAccent =
               html.tag('span', {class: 'other-group-accent'},
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 853a60f9..5838aa7d 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -1349,6 +1349,7 @@ groupInfoPage:
           {ALBUM} {OTHER_GROUP_ACCENT}
 
         accent: "(from {GROUPS})"
+        notFromThisGroup: "(not from {GROUP})"
 
       withArtists:
         _: >-