]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: improve usability of projects search form
authorJakub Narebski <redacted>
Tue, 31 Jan 2012 00:20:54 +0000 (01:20 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:31 +0000 (00:51 -0400)
Refactor generating project search form into git_project_search_form().

Make text field wider and add on mouse over explanation (via "title"
attribute), add an option to use regular expressions, and replace
'Search:' label with [Search] button.

Also add "List all projects" link to make it easier to go back from search
result to list of all projects (note that an empty search term is
disallowed).

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
static/gitweb.css

index 4e364ac03ac7e7b2761cc1ea938a93c55d24567320ff5bbdf8393be5a39e2412..bcfa1a7214812b8cb5e32bad6da59ce06e4e4d1c871dca5471d173bd325b6f51 100755 (executable)
@@ -5161,6 +5161,26 @@ sub git_patchset_body {
 
 # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 
+sub git_project_search_form {
+       my ($searchtext, $search_use_regexp);
+
+       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',
+                             -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";
+       print "</div>\n";
+}
+
 # fills project list info (age, description, owner, category, forks)
 # for each project in the list, removing invalid projects from
 # returned list
@@ -6028,11 +6048,8 @@ sub git_project_list {
                insert_file($home_text);
                print "</div>\n";
        }
-       print $cgi->startform(-method => "get") .
-             "<p class=\"projsearch\">Search:\n" .
-             $cgi->textfield(-name => "s", -value => $searchtext) . "\n" .
-             "</p>" .
-             $cgi->end_form() . "\n";
+
+       git_project_search_form($searchtext, $search_use_regexp);
        git_project_list_body(\@list, $order);
        git_footer_html();
 }
index 13ab6020719ba61eec5e47f80bde477c689107d9e6cdc04b2f2c22713cf4414d..9bcde8565d5e8c2ddec3a115a2eee90ef5c0b7d4b653b5d5c82689a36039f7e3 100644 (file)
@@ -520,8 +520,13 @@ div.search {
        right: 12px
 }
 
-p.projsearch {
+div.projsearch {
        text-align: center;
+       margin: 20px 0px;
+}
+
+div.projsearch form {
+       margin-bottom: 2px;
 }
 
 td.linenr {
This page took 0.41342 seconds and 4 git commands to generate.