summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Chars
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNWeb/Chars')
-rw-r--r--lib/VNWeb/Chars/List.pm22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/VNWeb/Chars/List.pm b/lib/VNWeb/Chars/List.pm
index 62b0d3e9..506f720f 100644
--- a/lib/VNWeb/Chars/List.pm
+++ b/lib/VNWeb/Chars/List.pm
@@ -5,6 +5,7 @@ use VNWeb::AdvSearch;
use VNWeb::Filters;
+# Also used by VNWeb::TT::TraitPage
sub listing_ {
my($opt, $list, $count) = @_;
my sub url { '?'.query_encode %$opt, @_ }
@@ -28,6 +29,18 @@ sub listing_ {
}
+# Also used by VNWeb::TT::TraitPage
+sub enrich_listing {
+ enrich vn => id => cid => sub { sql '
+ SELECT cv.id AS cid, v.id, v.title, v.original
+ FROM chars_vns cv
+ JOIN vn v ON v.id = cv.vid
+ WHERE NOT v.hidden AND cv.id IN', $_, '
+ ORDER BY v.title'
+ }, @_;
+}
+
+
TUWF::get qr{/c(?:/(?<char>all|[a-z0]))?}, sub {
my $opt = tuwf->validate(get =>
q => { onerror => undef },
@@ -75,14 +88,7 @@ TUWF::get qr{/c(?:/(?<char>all|[a-z0]))?}, sub {
) : [];
} || (($count, $list) = (undef, []));
- enrich vn => id => cid => sub { sql '
- SELECT cv.id AS cid, v.id, v.title, v.original
- FROM chars_vns cv
- JOIN vn v ON v.id = cv.vid
- WHERE NOT v.hidden AND cv.id IN', $_, '
- ORDER BY v.title'
- }, $list;
-
+ enrich_listing $list;
$time = time - $time;
framework_ title => 'Browse characters', sub {