diff options
author | Yorhel <git@yorhel.nl> | 2022-09-26 18:29:02 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2022-09-28 09:35:55 +0200 |
commit | 3ec6f29b4e11d29afd0f72a5dd1ef42fb4f22485 (patch) | |
tree | 0e7edbf6d61f37566f98b25487013625db9df792 /lib/VNWeb/Releases | |
parent | 506d4cf432794f521d706d430f78ac47fb394a8b (diff) |
Releases::Edit: Auto-fill VN titles when adding language to release
Diffstat (limited to 'lib/VNWeb/Releases')
-rw-r--r-- | lib/VNWeb/Releases/Edit.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/VNWeb/Releases/Edit.pm b/lib/VNWeb/Releases/Edit.pm index 522d405d..4263c1ca 100644 --- a/lib/VNWeb/Releases/Edit.pm +++ b/lib/VNWeb/Releases/Edit.pm @@ -16,6 +16,12 @@ my $FORM = { title => { required => 0, default => undef, maxlength => 300 }, latin => { required => 0, default => undef, maxlength => 300 }, } }, + # Titles fetched from the VN entry, for auto-filling + vntitles => { _when => 'out', aoh => { + lang => {}, + title => {}, + latin => { required => 0 }, + } }, olang => { enum => \%LANGUAGE, default => 'ja' }, platforms => { aoh => { platform => { enum => \%PLATFORM } } }, media => { aoh => { @@ -79,6 +85,8 @@ TUWF::get qr{/$RE{rrev}/(?<action>edit|copy)} => sub { $e->{titles} = [ sort { $a->{lang} cmp $b->{lang} } $e->{titles}->@* ]; to_extlinks $e; + $e->{vntitles} = tuwf->dbAlli('SELECT lang, title, latin FROM vn_titles WHERE id =', \$e->{vn}[0]{vid}) if $e->{vn}->@* == 1; + enrich_merge vid => 'SELECT id AS vid, title FROM vnt WHERE id IN', $e->{vn}; enrich_merge pid => 'SELECT id AS pid, name FROM producers WHERE id IN', $e->{producers}; @@ -109,6 +117,7 @@ TUWF::get qr{/$RE{vid}/add}, sub { my $e = { elm_empty($FORM_OUT)->%*, vn => [{vid => $v->{id}, title => $v->{title}, rtype => 'complete'}], + vntitles => tuwf->dbAlli('SELECT lang, title, latin FROM vn_titles WHERE id =', \$v->{id}), official => 1, }; $e->{authmod} = auth->permDbmod; |