@matheusbsbs / matheus-bagliano / commits / 1ee4b4ef70
Fork 0

gitweb: add a "string" variant of print_sort_th

Add a function (named format_sort_th) that returns the string that print_sort_th would print. Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John 'Warthog9' Hawley committed Jan 30, 2010 at 23:30 UTC 1ee4b4ef70e26c540d028cc497313000e63cd7dc
1 file changed +12 -5
gitweb/gitweb.perl
+12 -5
@@ -4347,17 +4347,24 @@ sub fill_project_list_info {
4347 # print 'sort by' <th> element, generating 'sort by $name' replay link
4348 # if that order is not selected
4349 sub print_sort_th {
4350 + print format_sort_th(@_);
4351 +}
4352 +
4353 +sub format_sort_th {
4354 my ($name, $order, $header) = @_;
4355 + my $sort_th = "";
4356 $header ||= ucfirst($name);
4357
4358 if ($order eq $name) {
4354 - print "<th>$header</th>\n";
4359 + $sort_th .= "<th>$header</th>\n";
4360 } else {
4356 - print "<th>" .
4357 - $cgi->a({-href => href(-replay=>1, order=>$name),
4358 - -class => "header"}, $header) .
4359 - "</th>\n";
4361 + $sort_th .= "<th>" .
4362 + $cgi->a({-href => href(-replay=>1, order=>$name),
4363 + -class => "header"}, $header) .
4364 + "</th>\n";
4365 }
4366 +
4367 + return $sort_th;
4368 }
4369
4370 sub git_project_list_body {