From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed
Date: Thu, 22 Jun 2006 00:42:22 +0200 [thread overview]
Message-ID: <11509297422173-git-send-email-jnareb@gmail.com> (raw)
For commits in oneline view (summary, shortlog, history) commit title
(first line of commit message) is link to commit itself. If commit title
(commit description) is shortened in output, hyperlink has title attribute
with full title.
This commit does the same also for tags. It is much more rare to have long
tag description, though.
Misfeature: sometimes tag link has title attribute even if tag description
doesn't seem to be shortened.
Needs refactoring (twice done almost exactly the same, four times similar
code is used).
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
e41a09e140c1ecd933ae90e7b55660d67f33dc1b
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e044c61..8f8ae4a 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -326,7 +326,7 @@ EOF
} elsif (defined $hash) {
$search_hash = $hash;
} else {
- $search_hash = "HEAD";
+ $search_hash = "HEAD";
}
$cgi->param("a", "search");
$cgi->param("h", $search_hash);
@@ -1107,7 +1107,8 @@ sub git_summary {
foreach my $entry (@$taglist) {
my %tag = %$entry;
my $comment_lines = $tag{'comment'};
- my $comment = shift @$comment_lines;
+ my $comment_long = shift @$comment_lines;
+ my $comment = $comment_long;
if (defined($comment)) {
$comment = chop_str($comment, 30, 5);
}
@@ -1119,13 +1120,17 @@ sub git_summary {
$alternate ^= 1;
if ($i-- > 0) {
print "<td><i>$tag{'age'}</i></td>\n" .
- "<td>" .
+ "<td>";
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
"<b>" . esc_html($tag{'name'}) . "</b>") .
"</td>\n" .
"<td>";
if (defined($comment)) {
- print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+ if (length($comment) < length($comment_long)) {
+ print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"), -title => "$comment_long"}, $comment);
+ } else {
+ print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+ }
}
print "</td>\n" .
"<td class=\"link\">";
@@ -1346,7 +1351,8 @@ sub git_tags {
foreach my $entry (@$taglist) {
my %tag = %$entry;
my $comment_lines = $tag{'comment'};
- my $comment = shift @$comment_lines;
+ my $comment_long = shift @$comment_lines;
+ my $comment = $comment_long;
if (defined($comment)) {
$comment = chop_str($comment, 30, 5);
}
@@ -1363,7 +1369,11 @@ sub git_tags {
"</td>\n" .
"<td>";
if (defined($comment)) {
- print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+ if (length($comment) < length($comment_long)) {
+ print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"), -title => "$comment_long"}, $comment);
+ } else {
+ print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+ }
}
print "</td>\n" .
"<td class=\"link\">";
--
1.3.0
next reply other threads:[~2006-06-21 22:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-21 22:42 Jakub Narebski [this message]
2006-06-21 23:10 ` [PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed Junio C Hamano
2006-06-22 6:54 ` Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11509297422173-git-send-email-jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).