@matheusbsbs / matheus-bagliano / commits / 17d0744318
Fork 0

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 <b>...</b> used to format title (subject) and move formatting to CSS. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Aug 14, 2006 at 02:08 UTC 17d07443188909ef5f8b8c24043cb6d9fef51bca
2 files changed +23 -16
gitweb/gitweb.css
+5
@@ -117,9 +117,14 @@ div.list_head {
117
118 a.list {
119 text-decoration: none;
120 + font-weight: bold;
121 color: #000000;
122 }
123
124 +table.tags a.list {
125 + font-weight: normal;
126 +}
127 +
128 a.list:hover {
129 text-decoration: underline;
130 color: #880000;
gitweb/gitweb.perl
+18 -16
@@ -372,6 +372,22 @@ sub format_ref_marker {
372 }
373 }
374
375 +# format, perhaps shortened and with markers, title line
376 +sub format_subject_html {
377 + my ($long, $short, $query, $extra) = @_;
378 + $extra = '' unless defined($extra);
379 +
380 + if (length($short) < length($long)) {
381 + return $cgi->a({-href => "$my_uri?" . esc_param($query),
382 + -class => "list", -title => $long},
383 + esc_html($short) . $extra);
384 + } else {
385 + return $cgi->a({-href => "$my_uri?" . esc_param($query),
386 + -class => "list"},
387 + esc_html($long) . $extra);
388 + }
389 +}
390 +
391 ## ----------------------------------------------------------------------
392 ## git utility subroutines, invoking git commands
393
@@ -1085,15 +1101,7 @@ sub git_shortlog_body {
1101 print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
1102 "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
1103 "<td>";
1088 - if (length($co{'title_short'}) < length($co{'title'})) {
1089 - print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"),
1090 - -class => "list", -title => "$co{'title'}"},
1091 - "<b>" . esc_html($co{'title_short'}) . "$ref</b>");
1092 - } else {
1093 - print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"),
1094 - -class => "list"},
1095 - "<b>" . esc_html($co{'title'}) . "$ref</b>");
1096 - }
1104 + print format_subject_html($co{'title'}, $co{'title_short'}, "p=$project;a=commit;h=$commit", $ref);
1105 print "</td>\n" .
1106 "<td class=\"link\">" .
1107 $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") . " | " .
@@ -1139,13 +1147,7 @@ sub git_tags_body {
1147 "</td>\n" .
1148 "<td>";
1149 if (defined $comment) {
1142 - if (length($comment_short) < length($comment)) {
1143 - print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"),
1144 - -class => "list", -title => $comment}, $comment_short);
1145 - } else {
1146 - print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"),
1147 - -class => "list"}, $comment);
1148 - }
1150 + print format_subject_html($comment, $comment_short, "p=$project;a=tag;h=$tag{'id'}");
1151 }
1152 print "</td>\n" .
1153 "<td class=\"selflink\">";