« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/static-page.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/static-page.js')
-rw-r--r--src/data/things/static-page.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/data/things/static-page.js b/src/data/things/static-page.js
new file mode 100644
index 00000000..226e0b61
--- /dev/null
+++ b/src/data/things/static-page.js
@@ -0,0 +1,30 @@
+import Thing from './thing.js';
+
+export class StaticPage extends Thing {
+  static [Thing.referenceType] = 'static';
+
+  static [Thing.getPropertyDescriptors] = ({
+    validators: {
+      isName,
+    },
+  }) => ({
+    // Update & expose
+
+    name: Thing.common.name('Unnamed Static Page'),
+
+    nameShort: {
+      flags: {update: true, expose: true},
+      update: {validate: isName},
+
+      expose: {
+        dependencies: ['name'],
+        transform: (value, {name}) => value ?? name,
+      },
+    },
+
+    directory: Thing.common.directory(),
+    content: Thing.common.simpleString(),
+    stylesheet: Thing.common.simpleString(),
+    showInNavigationBar: Thing.common.flag(true),
+  });
+}