From 17d07443188909ef5f8b8c24043cb6d9fef51bca Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Mon, 14 Aug 2006 02:08:27 +0200 Subject: gitweb: Refactor printing shortened title in git_shortlog_body and git_tags_body Separate printing of perhaps shortened title (subject) in git_shortlog_body and git_tags_body into format_subject_html. While at it, remove presentation element ... used to format title (subject) and move formatting to CSS. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.css | 5 +++++ gitweb/gitweb.perl | 34 ++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'gitweb') diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css index 47c1ade87..f58a418fa 100644 --- a/gitweb/gitweb.css +++ b/gitweb/gitweb.css @@ -117,9 +117,14 @@ div.list_head { a.list { text-decoration: none; + font-weight: bold; color: #000000; } +table.tags a.list { + font-weight: normal; +} + a.list:hover { text-decoration: underline; color: #880000; diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 0c4ec9289..c4d6eab77 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -372,6 +372,22 @@ sub format_ref_marker { } } +# format, perhaps shortened and with markers, title line +sub format_subject_html { + my ($long, $short, $query, $extra) = @_; + $extra = '' unless defined($extra); + + if (length($short) < length($long)) { + return $cgi->a({-href => "$my_uri?" . esc_param($query), + -class => "list", -title => $long}, + esc_html($short) . $extra); + } else { + return $cgi->a({-href => "$my_uri?" . esc_param($query), + -class => "list"}, + esc_html($long) . $extra); + } +} + ## ---------------------------------------------------------------------- ## git utility subroutines, invoking git commands @@ -1085,15 +1101,7 @@ sub git_shortlog_body { print "$co{'age_string_date'}\n" . "" . esc_html(chop_str($co{'author_name'}, 10)) . "\n" . ""; - if (length($co{'title_short'}) < length($co{'title'})) { - print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), - -class => "list", -title => "$co{'title'}"}, - "" . esc_html($co{'title_short'}) . "$ref"); - } else { - print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), - -class => "list"}, - "" . esc_html($co{'title'}) . "$ref"); - } + print format_subject_html($co{'title'}, $co{'title_short'}, "p=$project;a=commit;h=$commit", $ref); print "\n" . "" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") . " | " . @@ -1139,13 +1147,7 @@ sub git_tags_body { "\n" . ""; if (defined $comment) { - if (length($comment_short) < length($comment)) { - print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"), - -class => "list", -title => $comment}, $comment_short); - } else { - print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"), - -class => "list"}, $comment); - } + print format_subject_html($comment, $comment_short, "p=$project;a=tag;h=$tag{'id'}"); } print "\n" . ""; -- cgit v1.2.1