« 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/news-entry.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/news-entry.js')
-rw-r--r--src/data/things/news-entry.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/data/things/news-entry.js b/src/data/things/news-entry.js
new file mode 100644
index 0000000..4391141
--- /dev/null
+++ b/src/data/things/news-entry.js
@@ -0,0 +1,27 @@
+import Thing from './thing.js';
+
+export class NewsEntry extends Thing {
+  static [Thing.referenceType] = 'news-entry';
+
+  static [Thing.getPropertyDescriptors] = () => ({
+    // Update & expose
+
+    name: Thing.common.name('Unnamed News Entry'),
+    directory: Thing.common.directory(),
+    date: Thing.common.simpleDate(),
+
+    content: Thing.common.simpleString(),
+
+    // Expose only
+
+    contentShort: {
+      flags: {expose: true},
+
+      expose: {
+        dependencies: ['content'],
+
+        compute: ({content}) => content.split('<hr class="split">')[0],
+      },
+    },
+  });
+}