« get me outta code hell

divide things.js into modular files (hilariously) - 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:
author(quasar) nebula <qznebula@protonmail.com>2022-11-28 23:25:05 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-11-28 23:25:05 -0400
commit690a7b53a72ac71f9f76260fa50c634566c4e984 (patch)
tree841653cf0e474c6edd437ec36884f2130b5b7b43 /src/data/things/news-entry.js
parentae9dba60c4bbb327b402c500cc042922a954de74 (diff)
divide things.js into modular files (hilariously)
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 00000000..43911410
--- /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],
+      },
+    },
+  });
+}