summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Releases
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2022-09-26 18:14:49 +0200
committerYorhel <git@yorhel.nl>2022-09-28 09:35:55 +0200
commit506d4cf432794f521d706d430f78ac47fb394a8b (patch)
treef7c1ca53766d46066c010192d9854fee33440dd2 /lib/VNWeb/Releases
parentbb74e33f2eddbd90bf35a7237814ed80cda87ce4 (diff)
Allow non-main release titles to be empty
https://vndb.org/t17804.113 and beyond.
Diffstat (limited to 'lib/VNWeb/Releases')
-rw-r--r--lib/VNWeb/Releases/Edit.pm2
-rw-r--r--lib/VNWeb/Releases/Lib.pm7
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/VNWeb/Releases/Edit.pm b/lib/VNWeb/Releases/Edit.pm
index 00ac4d24..522d405d 100644
--- a/lib/VNWeb/Releases/Edit.pm
+++ b/lib/VNWeb/Releases/Edit.pm
@@ -13,7 +13,7 @@ my $FORM = {
titles => { minlength => 1, sort_keys => 'lang', aoh => {
lang => { enum => \%LANGUAGE },
mtl => { anybool => 1 },
- title => { maxlength => 300 },
+ title => { required => 0, default => undef, maxlength => 300 },
latin => { required => 0, default => undef, maxlength => 300 },
} },
olang => { enum => \%LANGUAGE, default => 'ja' },
diff --git a/lib/VNWeb/Releases/Lib.pm b/lib/VNWeb/Releases/Lib.pm
index 2629207c..a76c8d4b 100644
--- a/lib/VNWeb/Releases/Lib.pm
+++ b/lib/VNWeb/Releases/Lib.pm
@@ -29,7 +29,7 @@ sub releases_by_vn {
sub enrich_release {
my($r) = @_;
enrich_merge id =>
- 'SELECT id, title, alttitle, notes, minage, official, freeware, has_ero, reso_x, reso_y, voiced, uncensored
+ 'SELECT id, title, alttitle, olang, notes, minage, official, freeware, has_ero, reso_x, reso_y, voiced, uncensored
, ani_story, ani_ero, ani_story_sp, ani_story_cg, ani_cutscene, ani_ero_sp, ani_ero_cg, ani_face, ani_bg
FROM releasest WHERE id IN', $r;
enrich_merge id => sub { sql 'SELECT id, MAX(rtype) AS rtype FROM releases_vn WHERE id IN', $_, 'GROUP BY id' }, grep !$_->{rtype}, ref $r ? @$r : $r;
@@ -157,7 +157,10 @@ sub release_row_ {
abbr_ class => "icons rt$r->{rtype}", title => $r->{rtype}, '';
};
td_ class => 'tc4', sub {
- my($title, $alttitle) = $lang ? langpref_titles $lang->{lang}, [$lang] : @{$r}{'title', 'alttitle'};
+ my($title, $alttitle) =
+ $lang && defined $lang->{title} ? langpref_titles $lang->{lang}, [$lang] :
+ $lang ? langpref_titles $r->{olang}, [grep $_->{lang} eq $r->{olang}, $r->{titles}->@*]
+ : @{$r}{'title', 'alttitle'};
a_ href => "/$r->{id}", title => $alttitle||$title, $title;
my $note = join ' ', $r->{official} ? () : 'unofficial', $mtl ? 'machine translation' : (), $r->{patch} ? 'patch' : ();
b_ class => 'grayedout', " ($note)" if $note;