summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler/VNBrowse.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2019-06-28 15:31:43 +0200
committerYorhel <git@yorhel.nl>2019-06-28 15:31:45 +0200
commita91d48ac617b758a8310c28e91b73e23dae90963 (patch)
tree3613ca657a3c9e709ff35e0b94606fa9d83f95b1 /lib/VNDB/Handler/VNBrowse.pm
parent670c294ff6efeead61e215679224604848229c82 (diff)
VNBrowse: Add character filters
This is a bit experimental, not sure how the performance is going to be.
Diffstat (limited to 'lib/VNDB/Handler/VNBrowse.pm')
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index edc42621..554541a7 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -23,6 +23,7 @@ sub list {
{ get => 'sq', required => 0, default => '' },
{ get => 'fil',required => 0 },
{ get => 'rfil', required => 0, default => '' },
+ { get => 'cfil', required => 0, default => '' },
{ get => 'vnlist', required => 0, default => 2, enum => [ '0', '1' ] }, # 2: use pref
{ get => 'wish', required => 0, default => 2, enum => [ '0', '1' ] }, # 2: use pref
);
@@ -55,6 +56,9 @@ sub list {
$self->filCompat(release => $rfil);
$f->{rfil} = fil_serialize $rfil, @{$VNDB::Util::Misc::filfields{release}};
+ my $cfil = fil_parse $f->{cfil}, @{$VNDB::Util::Misc::filfields{char}};
+ $cfil->{tagspoil} //= $self->authPref('spoilers')||0 if keys %$cfil;
+
my($list, $np) = $self->filFetchDB(vn => $f->{fil}, {
%compat,
tagspoil => $self->authPref('spoilers')||0,
@@ -65,6 +69,7 @@ sub list {
$char ne 'all' ? ( char => $char ) : (),
$f->{q} ? ( search => $f->{q} ) : (),
keys %$rfil ? ( release => $rfil ) : (),
+ keys %$cfil ? ( character => $cfil ) : (),
results => 50,
page => $f->{p},
sort => $f->{s}, reverse => $f->{o} eq 'd',
@@ -82,7 +87,7 @@ sub list {
my $url = sub {
my($char, $toggle) = @_;
- return "/v/$char?q=$quri;fil=$f->{fil};rfil=$f->{rfil};s=$f->{s};o=$f->{o}" .
+ return "/v/$char?q=$quri;fil=$f->{fil};rfil=$f->{rfil};cfil=$f->{cfil};s=$f->{s};o=$f->{o}" .
($toggle ? ";$toggle=".($f->{$toggle}?0:1) : '');
};
@@ -108,13 +113,16 @@ sub list {
a id => 'rfilselect', href => '#r';
lit '<i>&#9656;</i> Release filters<i></i>';
end;
+ a id => 'cfilselect', href => '#c';
+ lit '<i>&#9656;</i> Character filters<i></i>';
+ end;
end;
input type => 'hidden', class => 'hidden', name => $_, id => $_, value => $f->{$_}
- for (qw{fil rfil s o});
+ for (qw{fil rfil cfil s o});
end;
end 'form';
- $self->htmlBrowseVN($list, $f, $np, "/v/$char?q=$quri;fil=$f->{fil};rfil=$f->{rfil}", $f->{fil} =~ /tag_inc-/);
+ $self->htmlBrowseVN($list, $f, $np, "/v/$char?q=$quri;fil=$f->{fil};rfil=$f->{rfil};cfil=$f->{cfil}", $f->{fil} =~ /tag_inc-/);
$self->htmlFooter(pref_code => 1);
}