Skip to content

Commit

Permalink
gitweb: Make project search respect project_filter
Browse files Browse the repository at this point in the history
Make gitweb search within filtered projects (i.e. projects shown), and
change "List all projects" to "List all projects in '$project_filter/'"
if project_filter is used.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Feb 1, 2012
1 parent a1e1b2d commit abc0c9d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -5161,20 +5161,28 @@ sub git_patchset_body {
sub git_project_search_form {
my ($searchtext, $search_use_regexp);

my $limit = '';
if ($project_filter) {
$limit = " in '$project_filter/'";
}

print "<div class=\"projsearch\">\n";
print $cgi->startform(-method => 'get', -action => $my_uri) .
$cgi->hidden(-name => 'a', -value => 'project_list') . "\n" .
$cgi->textfield(-name => 's', -value => $searchtext,
-title => 'Search project by name and description',
$cgi->hidden(-name => 'a', -value => 'project_list') . "\n";
print $cgi->hidden(-name => 'pf', -value => $project_filter). "\n"
if (defined $project_filter);
print $cgi->textfield(-name => 's', -value => $searchtext,
-title => "Search project by name and description$limit",
-size => 60) . "\n" .
"<span title=\"Extended regular expression\">" .
$cgi->checkbox(-name => 'sr', -value => 1, -label => 're',
-checked => $search_use_regexp) .
"</span>\n" .
$cgi->submit(-name => 'btnS', -value => 'Search') .
$cgi->end_form() . "\n" .
$cgi->a({-href => href(project => undef, searchtext => undef)},
'List all projects') . "<br />\n";
$cgi->a({-href => href(project => undef, searchtext => undef,
project_filter => $project_filter)},
esc_html("List all projects$limit")) . "<br />\n";
print "</div>\n";
}

Expand Down

0 comments on commit abc0c9d

Please sign in to comment.