« get me outta code hell

data: flash-act: inherit list terminology from side - 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-04-03 14:05:23 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-04-03 14:05:23 -0300
commit27e67da7b6f31b6d6da52a7ad09a0da1acc06e03 (patch)
treedfd48f1e420a20ed9a2d032ba766934b844326f9 /src
parentedf927a8d145e27f137d957d20c477c31f1151c3 (diff)
data: flash-act: inherit list terminology from side
Diffstat (limited to 'src')
-rw-r--r--src/data/checks.js4
-rw-r--r--src/data/things/flash.js36
2 files changed, 36 insertions, 4 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index 3c8f6f92..0ea384ac 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -488,6 +488,10 @@ export function reportContentTextErrors(wikiData, {
       listTerminology: '_content',
     }],
 
+    ['flashSideData', {
+      listTerminology: '_content',
+    }],
+
     ['groupData', {
       description: '_content',
     }],
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 5500707d..dc6a32df 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -4,14 +4,20 @@ import {input} from '#composite';
 import find from '#find';
 import {sortFlashesChronologically} from '#sort';
 import Thing from '#thing';
-import {anyOf, isColor, isDirectory, isNumber, isString} from '#validators';
+import {anyOf, isColor, isContentString, isDirectory, isNumber, isString}
+  from '#validators';
 import {parseDate, parseContributors} from '#yaml';
 
-import {exposeDependency, exposeUpdateValueOrContinue}
-  from '#composite/control-flow';
 import {withPropertyFromObject} from '#composite/data';
 
 import {
+  exposeConstant,
+  exposeDependency,
+  exposeDependencyOrContinue,
+  exposeUpdateValueOrContinue,
+} from '#composite/control-flow';
+
+import {
   color,
   contentString,
   contributionList,
@@ -179,7 +185,27 @@ export class FlashAct extends Thing {
     name: name('Unnamed Flash Act'),
     directory: directory(),
     color: color(),
-    listTerminology: contentString(),
+
+    listTerminology: [
+      exposeUpdateValueOrContinue({
+        validate: input.value(isContentString),
+      }),
+
+      withFlashSide(),
+
+      withPropertyFromObject({
+        object: '#flashSide',
+        property: input.value('listTerminology'),
+      }),
+
+      exposeDependencyOrContinue({
+        dependency: '#flashSide.listTerminology',
+      }),
+
+      exposeConstant({
+        value: input.value(null),
+      }),
+    ],
 
     flashes: referenceList({
       class: input.value(Flash),
@@ -235,6 +261,7 @@ export class FlashSide extends Thing {
     name: name('Unnamed Flash Side'),
     directory: directory(),
     color: color(),
+    listTerminology: contentString(),
 
     acts: referenceList({
       class: input.value(FlashAct),
@@ -254,6 +281,7 @@ export class FlashSide extends Thing {
       'Side': {property: 'name'},
       'Directory': {property: 'directory'},
       'Color': {property: 'color'},
+      'List Terminology': {property: 'listTerminology'},
     },
   };