« get me outta code hell

data: art tags: short names - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-08-06 17:32:26 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-08-06 17:32:26 -0300
commitb1f116b28580e67a82c2d0eaea2b51fb0aee59b2 (patch)
tree7203cb0ada7f2a9543c7c33dcfccff09e0875fb3 /src/data
parentdc4d726d7a4e6a89d3f1e9e2af0d334472976ae3 (diff)
data: art tags: short names
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/art-tag.js10
-rw-r--r--src/data/yaml.js2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/data/things/art-tag.js b/src/data/things/art-tag.js
index 9a8a75c5..75fb0f7b 100644
--- a/src/data/things/art-tag.js
+++ b/src/data/things/art-tag.js
@@ -18,6 +18,16 @@ export class ArtTag extends Thing {
     color: Thing.common.color(),
     isContentWarning: Thing.common.flag(false),
 
+    nameShort: {
+      flags: {update: true, expose: true},
+
+      expose: {
+        dependencies: ['name'],
+        transform: (value, {name}) =>
+          value ?? name.replace(/ \(.*?\)$/, ''),
+      },
+    },
+
     // Update only
 
     albumData: Thing.common.wikiData(Album),
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 73450f17..37b1f86c 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -343,7 +343,9 @@ export const processNewsEntryDocument = makeProcessDocument(T.NewsEntry, {
 export const processArtTagDocument = makeProcessDocument(T.ArtTag, {
   propertyFieldMapping: {
     name: 'Tag',
+    nameShort: 'Short Name',
     directory: 'Directory',
+
     color: 'Color',
     isContentWarning: 'Is CW',
   },