Thread (17 messages) flat view 17 messages, 3 authors, 2016-06-15

[PATCHv3] gitweb: ref markers link to named shortlogs

From: Giuseppe Bilotta <hidden>
Date: 2016-06-15 22:45:12
Subsystem: the rest · Maintainer: Linus Torvalds

This patch turns ref markers into links to appropriate views for the ref
name, using the full ref name as hash. Appropriate changes are made in
the CSS to prevent ref markers to be annoyingly blue and underlined,
unless hovered on.

For all git ref types it's assumed that the preferred view is named like
the ref type itself. If the corresponding action is not defined,
shortlog is used.

Signed-off-by: Giuseppe Bilotta <redacted>
---

Following Jakub Narebski's suggestions, an underlined :hover is
added for the ref marker css, and we use $type instead of
$git_type, sparing ourselves a bunch of git calls.

An additional change wrt the previous version is that the full ref
name is used (to link to the correct object when e.g. a head and a
tag by the same name exist).

 gitweb/gitweb.css  |    9 +++++++++
 gitweb/gitweb.perl |    3 ++-
 2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index aa0eeca..fadce1b 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -481,6 +481,15 @@ span.refs span {
 	border-color: #ffccff #ff00ee #ff00ee #ffccff;
 }
 
+span.refs span a {
+	text-decoration: none;
+	color: inherit;
+}
+
+span.refs span a:hover {
+	text-decoration: underline;
+}
+
 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..77b2442 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1107,7 +1107,8 @@ sub format_ref_marker {
 			}
 
 			$markers .= " <span class=\"$type\" title=\"$ref\">" .
-			            esc_html($name) . "</span>";
+				$cgi->a({-href => href(action=> $actions{$type} || "shortlog", hash=>$ref)}, $name) .
+				"</span>";
 		}
 	}
 
-- 
1.5.6.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help