git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: ref markers link to named shortlogs
@ 2008-08-02 15:39 Giuseppe Bilotta
  2008-08-03 12:03 ` Petr Baudis
  0 siblings, 1 reply; 23+ messages in thread
From: Giuseppe Bilotta @ 2008-08-02 15:39 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Petr Baudis, Giuseppe Bilotta

This patch turns ref markers for tags and heads into links to
shortlog/refname. Appropriate changes are made in the CSS to prevent ref
markers to be annoyingly blue and underlined.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 gitweb/gitweb.css  |    5 +++++
 gitweb/gitweb.perl |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index aa0eeca..2b43eea 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -481,6 +481,11 @@ span.refs span {
 	border-color: #ffccff #ff00ee #ff00ee #ffccff;
 }
 
+span.refs span a {
+	text-decoration: none;
+	color: inherit;
+}
+
 span.refs span.ref {
 	background-color: #aaaaff;
 	border-color: #ccccff #0033cc #0033cc #ccccff;
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 90cd99b..7f391fa 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1093,6 +1093,7 @@ sub format_log_line_html {
 sub format_ref_marker {
 	my ($refs, $id) = @_;
 	my $markers = '';
+	my $htmltext;
 
 	if (defined $refs->{$id}) {
 		foreach my $ref (@{$refs->{$id}}) {
@@ -1101,13 +1102,15 @@ sub format_ref_marker {
 			if ($ref =~ m!^(.*?)s?/(.*)$!) {
 				$type = $1;
 				$name = $2;
+				$htmltext = $cgi->a({-href => href(action=>"shortlog", hash=>$name)}, $name);
 			} else {
 				$type = "ref";
 				$name = $ref;
+				$htmltext = esc_html($name);
 			}
 
 			$markers .= " <span class=\"$type\" title=\"$ref\">" .
-			            esc_html($name) . "</span>";
+			            $htmltext . "</span>";
 		}
 	}
 
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [PATCH] gitweb: ref markers link to named shortlogs
@ 2008-08-21 18:04 Giuseppe Bilotta
  2008-08-21 21:32 ` Jakub Narebski
  2008-08-24 19:30 ` Lea Wiemann
  0 siblings, 2 replies; 23+ messages in thread
From: Giuseppe Bilotta @ 2008-08-21 18:04 UTC (permalink / raw)
  To: git; +Cc: Petr Baudis, Jakub Narebski, Giuseppe Bilotta

This patch turns ref markers for tags and heads into links to
appropriate views for the ref name. Appropriate changes are made in the
CSS to prevent ref markers to be annoyingly blue and underlined.

For all git ref types it's assumed that the preferred view is named like
the ref type itself. For commits, we map the view to shortlog.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---

This is a resend of version 2 of the patch, as it seems to have
dropped into oblivion without ACKs or NACKs.

 gitweb/gitweb.css  |    5 +++++
 gitweb/gitweb.perl |    7 ++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index aa0eeca..2b43eea 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -481,6 +481,11 @@ span.refs span {
 	border-color: #ffccff #ff00ee #ff00ee #ffccff;
 }
 
+span.refs span a {
+	text-decoration: none;
+	color: inherit;
+}
+
 span.refs span.ref {
 	background-color: #aaaaff;
 	border-color: #ccccff #0033cc #0033cc #ccccff;
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 90cd99b..a12ce87 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1093,10 +1093,14 @@ sub format_log_line_html {
 sub format_ref_marker {
 	my ($refs, $id) = @_;
 	my $markers = '';
+	my %view = (
+		"commit" => "shortlog",
+	);
 
 	if (defined $refs->{$id}) {
 		foreach my $ref (@{$refs->{$id}}) {
 			my ($type, $name) = qw();
+			my $git_type = git_get_type($ref);
 			# e.g. tags/v2.6.11 or heads/next
 			if ($ref =~ m!^(.*?)s?/(.*)$!) {
 				$type = $1;
@@ -1107,7 +1111,8 @@ sub format_ref_marker {
 			}
 
 			$markers .= " <span class=\"$type\" title=\"$ref\">" .
-			            esc_html($name) . "</span>";
+				$cgi->a({-href => href(action=>$view{$git_type} || $git_type, hash=>$name)}, $name) .
+				"</span>";
 		}
 	}
 
-- 
1.5.6.3

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

end of thread, other threads:[~2008-08-28  6:49 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-02 15:39 [PATCH] gitweb: ref markers link to named shortlogs Giuseppe Bilotta
2008-08-03 12:03 ` Petr Baudis
2008-08-03 13:14   ` Giuseppe Bilotta
2008-08-03 13:20     ` Petr Baudis
2008-08-03 20:48       ` [PATCHv2] " Giuseppe Bilotta
  -- strict thread matches above, loose matches on Subject: below --
2008-08-21 18:04 [PATCH] " Giuseppe Bilotta
2008-08-21 21:32 ` Jakub Narebski
2008-08-22  7:21   ` Giuseppe Bilotta
2008-08-22  8:49     ` Jakub Narebski
     [not found]       ` <cb7bb73a0808220231w37d2341eic56cabb595399f68@mail.gmail.com>
2008-08-22 10:56         ` Jakub Narebski
2008-08-22 12:34           ` Giuseppe Bilotta
2008-08-24 19:30 ` Lea Wiemann
2008-08-24 19:41   ` Giuseppe Bilotta
2008-08-24 20:37   ` Jakub Narebski
2008-08-25 23:28     ` Giuseppe Bilotta
2008-08-26  8:15       ` Jakub Narebski
2008-08-26 10:58         ` Giuseppe Bilotta
2008-08-26 11:49           ` Jakub Narebski
2008-08-26 12:29             ` Giuseppe Bilotta
2008-08-27 18:36             ` Giuseppe Bilotta
2008-08-28  1:43             ` Lea Wiemann
2008-08-28  6:26               ` Giuseppe Bilotta
2008-08-28  6:48               ` 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).