summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2008-11-30 15:00:41 +0100
committerYorhel <git@yorhel.nl>2008-11-30 15:00:41 +0100
commit3f747b5fce24fad0635be727c431e1fb234c3fa6 (patch)
tree0e9e9baf1af0daa103a3b83e82c9113831976865 /lib
parent29a452e94a5b5a2aabf7d3502c8423deb786dbcb (diff)
Searchbox
It's not the nicest placing for a search box, but I couldn't think of anything else...
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm4
-rw-r--r--lib/VNDB/Util/LayoutHTML.pm11
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index 2855a39c..410e5de4 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -20,8 +20,10 @@ sub list {
{ name => 'o', required => 0, default => 'a', enum => [ 'a','d' ] },
{ name => 'p', required => 0, default => 1, template => 'int' },
{ name => 'q', required => 0, default => '' },
+ { name => 'sq', required => 0, default => '' },
);
return 404 if $f->{_err};
+ $f->{q} ||= $f->{sq};
# NOTE: this entire search thingy can also be done using a PgSQL fulltext search,
# which is faster and requires less code. It does require an extra database
@@ -69,7 +71,7 @@ sub list {
$self->resRedirect('/v'.$list->[0]{id}, 'temp')
if $q && @$list == 1;
- $self->htmlHeader(title => 'Browse visual novels');
+ $self->htmlHeader(title => 'Browse visual novels', search => $f->{q});
div class => 'mainbox';
h1 'Browse visual novels';
diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm
index 758ce444..94491e01 100644
--- a/lib/VNDB/Util/LayoutHTML.pm
+++ b/lib/VNDB/Util/LayoutHTML.pm
@@ -9,7 +9,7 @@ use Exporter 'import';
our @EXPORT = qw|htmlHeader htmlFooter|;
-sub htmlHeader { # %options->{ title }
+sub htmlHeader { # %options->{ title, js, search }
my($self, %o) = @_;
# heading
@@ -40,7 +40,7 @@ sub htmlHeader { # %options->{ title }
sub _menu {
- my $self = shift;
+ my($self, %o) = @_;
div id => 'menulist';
@@ -55,6 +55,13 @@ sub _menu {
a href => '/t', 'Discussion board'; br;
a href => '#', 'FAQ'; br;
end;
+ form action => '/v/all', method => 'get', id => 'search';
+ fieldset;
+ legend 'Search';
+ input type => 'text', class => 'text', id => 'sq', name => 'sq', value => $o{search}||'search';
+ input type => 'submit', class => 'submit', value => 'Seach';
+ end;
+ end;
end;
div class => 'menubox';