« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-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'},
     },
   };