git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] gitweb: Project search improvements
@ 2012-01-31  0:20 Jakub Narebski
  2012-01-31  0:20 ` [PATCH 1/2] gitweb: Improve projects search form Jakub Narebski
  2012-01-31  0:20 ` [PATCH 2/2] gitweb: Make project search respect project_filter Jakub Narebski
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Narebski @ 2012-01-31  0:20 UTC (permalink / raw)
  To: git; +Cc: Bernhard R. Link, Jakub Narebski

This was once a part of larger series improving project search in
gitweb, but those two patches can stand alone.  I am sending this
series (especially the second patch) in response to Bernhard patches
adding support for project_filter.

These patches should be applied on top of his work, i.e. on top of
'bl/gitweb-project-filter' branch.

Jakub Narebski (2):
  gitweb: Improve projects search form
  gitweb: Make project search respect project_filter

 gitweb/gitweb.perl       |   35 ++++++++++++++++++++++++++++++-----
 gitweb/static/gitweb.css |    7 ++++++-
 2 files changed, 36 insertions(+), 6 deletions(-)

-- 
1.7.6

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] gitweb: Improve projects search form
  2012-01-31  0:20 [PATCH 0/2] gitweb: Project search improvements Jakub Narebski
@ 2012-01-31  0:20 ` Jakub Narebski
  2012-01-31  0:20 ` [PATCH 2/2] gitweb: Make project search respect project_filter Jakub Narebski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2012-01-31  0:20 UTC (permalink / raw)
  To: git; +Cc: Bernhard R. Link, Jakub Narebski

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 empty search term
is disallowed).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
The major advantage is that you can use regular expression in
searching projects... well, at least there is UI for it, because you
could handcraft URL earlier anyway.

This patch was presented on git mailing list earlier.

 gitweb/gitweb.perl       |   27 ++++++++++++++++++++++-----
 gitweb/static/gitweb.css |    7 ++++++-
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index fa8a300..c4e0d8e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5155,6 +5155,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
@@ -6022,11 +6042,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();
 }
diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index c7827e8..c530355 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -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 {
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] gitweb: Make project search respect project_filter
  2012-01-31  0:20 [PATCH 0/2] gitweb: Project search improvements Jakub Narebski
  2012-01-31  0:20 ` [PATCH 1/2] gitweb: Improve projects search form Jakub Narebski
@ 2012-01-31  0:20 ` Jakub Narebski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Narebski @ 2012-01-31  0:20 UTC (permalink / raw)
  To: git; +Cc: Bernhard R. Link, Jakub Narebski

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>
---
This patch is new.

 gitweb/gitweb.perl |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c4e0d8e..80975dd 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5158,11 +5158,18 @@ 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',
@@ -5170,8 +5177,9 @@ sub git_project_search_form {
 	      "</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";
 }
 
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-31  0:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-31  0:20 [PATCH 0/2] gitweb: Project search improvements Jakub Narebski
2012-01-31  0:20 ` [PATCH 1/2] gitweb: Improve projects search form Jakub Narebski
2012-01-31  0:20 ` [PATCH 2/2] gitweb: Make project search respect project_filter Jakub Narebski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).