summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Releases
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-11-10 14:30:20 +0100
committerYorhel <git@yorhel.nl>2019-11-10 14:34:08 +0100
commitf5ede9e020c47c49567ada2cfa52ca1b926b4c12 (patch)
tree54a5f4fe5c8f26179cfb1ddf6b6a9c08f5cfcc17 /lib/VNWeb/Releases
parent194d9d43593937d835cca00719a2b0639213ebb3 (diff)
ulist: Add feature to add releases to the list
Diffstat (limited to 'lib/VNWeb/Releases')
-rw-r--r--lib/VNWeb/Releases/JS.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/VNWeb/Releases/JS.pm b/lib/VNWeb/Releases/JS.pm
new file mode 100644
index 00000000..0ecc05aa
--- /dev/null
+++ b/lib/VNWeb/Releases/JS.pm
@@ -0,0 +1,21 @@
+package VNWeb::Releases::JS;
+
+use VNWeb::Prelude;
+
+
+# Used by UList.Opt to fetch releases from a VN id.
+json_api qr{/r/get.json}, { vid => { id => 1 } }, sub {
+ my($data) = @_;
+ my $l = tuwf->dbAlli(
+ 'SELECT r.id, r.title, r.original, r.type AS rtype, r.released
+ FROM releases r
+ JOIN releases_vn rv ON rv.id = r.id
+ WHERE NOT r.hidden
+ AND rv.vid =', \$data->{vid},
+ 'ORDER BY r.released, r.title, r.id'
+ );
+ enrich_flatten lang => id => id => sub { sql('SELECT id, lang FROM releases_lang WHERE id IN', $_, 'ORDER BY lang') }, $l;
+ elm_Releases $l;
+};
+
+1;