« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util/link.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/link.js')
-rw-r--r--src/util/link.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/link.js b/src/util/link.js
index 4e611df..6853962 100644
--- a/src/util/link.js
+++ b/src/util/link.js
@@ -94,6 +94,19 @@ const link = {
     tag: linkDirectory('tag'),
     track: linkDirectory('track', {expose: 'data-track'}),
 
+    // TODO: This is a bit hacky. Files are just strings (not objects), so we
+    // have to manually provide the album alongside the file. They also don't
+    // follow the usual {name: whatever} type shape, so we have to provide that
+    // ourselves.
+    _albumAdditionalFileHelper: linkHelper(
+        ((fakeFileObject, { to }) =>
+            to('media.albumAdditionalFile', fakeFileObject.album.directory, fakeFileObject.name)),
+        {color: false}),
+    albumAdditionalFile: ({ file, album }, { to }) => link._albumAdditionalFileHelper({
+        name: file,
+        album
+    }, {to}),
+
     media: linkPathname('media.path', {color: false}),
     root: linkPathname('shared.path', {color: false}),
     data: linkPathname('data.path', {color: false}),