@matheusbsbs / matheus-bagliano / commits / 4df118ed60
Fork 0

gitweb: Improve git_print_page_path

Add link to "tree root" (root directory) also for not defined name, for example for "tree" action without defined "file_name" which means "tree root". Add " / " at the end of path when $type eq "tree". Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Oct 21, 2006 at 17:53 UTC 4df118ed6041dc0f126d55231a6621be05882b5f
1 file changed +8 -8
gitweb/gitweb.perl
+8 -8
@@ -1615,17 +1615,16 @@ sub git_print_page_path {
1615 my $type = shift;
1616 my $hb = shift;
1617
1618 - if (!defined $name) {
1619 - print "<div class=\"page_path\">/</div>\n";
1620 - } else {
1618 +
1619 + print "<div class=\"page_path\">";
1620 + print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
1621 + -title => 'tree root'}, "[$project]");
1622 + print " / ";
1623 + if (defined $name) {
1624 my @dirname = split '/', $name;
1625 my $basename = pop @dirname;
1626 my $fullname = '';
1627
1625 - print "<div class=\"page_path\">";
1626 - print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
1627 - -title => 'tree root'}, "[$project]");
1628 - print " / ";
1628 foreach my $dir (@dirname) {
1629 $fullname .= ($fullname ? '/' : '') . $dir;
1630 print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
@@ -1641,11 +1640,12 @@ sub git_print_page_path {
1640 print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
1641 hash_base=>$hb),
1642 -title => $name}, esc_html($basename));
1643 + print " / ";
1644 } else {
1645 print esc_html($basename);
1646 }
1647 - print "<br/></div>\n";
1647 }
1648 + print "<br/></div>\n";
1649 }
1650
1651 # sub git_print_log (\@;%) {