summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-05-24 10:32:57 +0200
committerYorhel <git@yorhel.nl>2009-05-24 10:32:57 +0200
commitce482a878851d5aa6d11f7a46e8a68ec480b82c6 (patch)
treebf11800bd308ba501fb786198678d5cdb48af000 /lib
parent1e960aae90bc7a94365bdd1578a7852f996c8d93 (diff)
/r: Automatically display filters when nothing is set or no results were found
And don't perform a search when no filters are set.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/Releases.pm21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 4dbabf5e..db874b1f 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -477,10 +477,7 @@ sub browse {
);
return 404 if $f->{_err};
- my($list, $np) = $self->dbReleaseGet(
- order => $f->{s}.($f->{o}eq'd'?' DESC':' ASC'),
- page => $f->{p},
- results => 50,
+ my @filters = (
$f->{mi} > 0 || $f->{ma} < 99990000 ? (date => [ $f->{mi}, $f->{ma} ]) : (),
$f->{q} ? (search => $f->{q}) : (),
$f->{pl}[0] ? (platforms => $f->{pl}) : (),
@@ -489,7 +486,13 @@ sub browse {
$f->{tp} >= 0 ? (type => $f->{tp}) : (),
$f->{ma_a} || $f->{ma_m} ? (minage => [$f->{ma_m}, $f->{ma_a}]) : (),
$f->{pa} ? (patch => $f->{pa}) : (),
+ );
+ my($list, $np) = !@filters ? (undef, 0) : $self->dbReleaseGet(
+ order => $f->{s}.($f->{o}eq'd'?' DESC':' ASC'),
+ page => $f->{p},
+ results => 50,
what => 'platforms',
+ @filters,
);
my $url = "/r?tp=$f->{tp};pa=$f->{pa};ma_m=$f->{ma_m};ma_a=$f->{ma_a};q=$f->{q};mi=$f->{mi};ma=$f->{ma}";
@@ -497,7 +500,7 @@ sub browse {
$_&&($url .= ";pl=$_") for @{$f->{pl}};
$self->htmlHeader(title => 'Browse releases');
- _filters($self, $f);
+ _filters($self, $f, !@filters || !$list);
$self->htmlBrowse(
class => 'relbrowse',
items => $list,
@@ -529,13 +532,13 @@ sub browse {
end;
end;
},
- );
+ ) if $list;
$self->htmlFooter;
}
sub _filters {
- my($self, $f) = @_;
+ my($self, $f, $shown) = @_;
form method => 'get', action => '/r', 'accept-charset' => 'UTF-8';
div class => 'mainbox';
@@ -547,9 +550,9 @@ sub _filters {
end;
a id => 'advselect', href => '#';
- lit '<i>&#9656;</i> filters';
+ lit '<i>'.($shown?'&#9662;':'&#9656;').'</i> filters';
end;
- div id => 'advoptions', class => 'hidden';
+ div id => 'advoptions', !$shown ? (class => 'hidden') : ();
h2 'Filters';
table class => 'formtable', style => 'margin-left: 0';