summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-05-31 17:47:10 +0200
committerYorhel <git@yorhel.nl>2009-05-31 17:47:10 +0200
commit2573d3d310e3636f466e1d0bd97c52882fb8b7c0 (patch)
treed0b23ff4b6e213285365d587a3640b7b2b565172 /lib
parent776743c0b8f1adb6f6335b7c1bb30323879cf98c (diff)
Tabs on v/r/p/g search fields
This should make a nice connection between the few kinds of database entries we have.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/Handler/Producers.pm5
-rw-r--r--lib/VNDB/Handler/Releases.pm5
-rw-r--r--lib/VNDB/Handler/Tags.pm12
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm5
-rw-r--r--lib/VNDB/Util/CommonHTML.pm19
5 files changed, 24 insertions, 22 deletions
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index 2aaa241d..5977ac1e 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -172,10 +172,7 @@ sub list {
div class => 'mainbox';
h1 'Browse producers';
form action => '/p/all', 'accept-charset' => 'UTF-8', method => 'get';
- fieldset class => 'search';
- input type => 'text', name => 'q', id => 'q', class => 'text', value => $f->{q};
- input type => 'submit', class => 'submit', value => 'Search!';
- end;
+ $self->htmlSearchBox('p', $f->{q});
end;
p class => 'browseopts';
for ('all', 'a'..'z', 0) {
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index e816b080..6b773c9f 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -563,10 +563,7 @@ sub _filters {
div class => 'mainbox';
h1 'Browse releases';
- fieldset class => 'search';
- input type => 'text', name => 'q', id => 'q', class => 'text', value => $f->{q};
- input type => 'submit', class => 'submit', value => 'Search!';
- end;
+ $self->htmlSearchBox('r', $f->{q});
a id => 'advselect', href => '#';
lit '<i>'.($shown?'&#9662;':'&#9656;').'</i> filters';
diff --git a/lib/VNDB/Handler/Tags.pm b/lib/VNDB/Handler/Tags.pm
index 6838e7c7..a6d02698 100644
--- a/lib/VNDB/Handler/Tags.pm
+++ b/lib/VNDB/Handler/Tags.pm
@@ -368,11 +368,8 @@ sub taglist {
div class => 'mainbox';
h1 $title;
form action => '/g/list', 'accept-charset' => 'UTF-8', method => 'get';
- fieldset class => 'search';
- input type => 'hidden', name => 't', value => $f->{t};
- input type => 'text', name => 'q', id => 'q', class => 'text', value => $f->{q};
- input type => 'submit', class => 'submit', value => 'Search!';
- end;
+ input type => 'hidden', name => 't', value => $f->{t};
+ $self->htmlSearchBox('g', $f->{q});
end;
p class => 'browseopts';
a href => "/g/list?q=$f->{q};t=-1", $f->{t} == -1 ? (class => 'optselected') : (), 'All';
@@ -590,10 +587,7 @@ sub tagindex {
a class => 'addnew', href => "/g/new", ($self->authCan('tagmod')?'Create':'Request').' new tag' if $self->authCan('tag');
h1 'Search tags';
form action => '/g/list', 'accept-charset' => 'UTF-8', method => 'get';
- fieldset class => 'search';
- input type => 'text', name => 'q', id => 'q', class => 'text';
- input type => 'submit', class => 'submit', value => 'Search!';
- end;
+ $self->htmlSearchBox('g', '');
end;
end;
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index 24fa8508..5eb8e4f8 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -103,10 +103,7 @@ sub _filters {
div class => 'mainbox';
h1 'Browse visual novels';
form action => '/v/all', 'accept-charset' => 'UTF-8', method => 'get';
- fieldset class => 'search';
- input type => 'text', name => 'q', id => 'q', class => 'text', value => $f->{q};
- input type => 'submit', class => 'submit', value => 'Search!';
- end;
+ $self->htmlSearchBox('v', $f->{q});
end;
p class => 'browseopts';
for ('all', 'a'..'z', 0) {
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index 1d6ae43b..7421b1c0 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -12,7 +12,7 @@ use POSIX 'ceil';
our @EXPORT = qw|
htmlMainTabs htmlDenied htmlHiddenMessage htmlBrowse htmlBrowseNavigate
- htmlRevision htmlEditMessage htmlItemMessage htmlVoteStats htmlHistory
+ htmlRevision htmlEditMessage htmlItemMessage htmlVoteStats htmlHistory htmlSearchBox
|;
@@ -518,4 +518,21 @@ sub htmlHistory {
}
+sub htmlSearchBox {
+ my($self, $sel, $v) = @_;
+
+ p class => 'searchtabs';
+ a href => '/v/all', $sel eq 'v' ? (class => 'sel') : (), 'Visual novels';
+ a href => '/r', $sel eq 'r' ? (class => 'sel') : (), 'Releases';
+ a href => '/p/all', $sel eq 'p' ? (class => 'sel') : (), 'Producers';
+ a href => '/g', $sel eq 'g' ? (class => 'sel') : (), 'Tags';
+ end;
+ fieldset class => 'search';
+ input type => 'text', name => 'q', id => 'q', class => 'text', value => $v;
+ input type => 'submit', class => 'submit', value => 'Search!';
+ end;
+}
+
+
+
1;