@matheusbsbs / matheus-bagliano / commits / 762c7205f6
Fork 0

gitweb: Divide page path into directories -- path's "breadcrumbs"

Divide page path into directories, so that each part of path links to the "tree" view of the $hash_base (or HEAD, if $hash_base is not set) version of the directory. If the entity is blob, final part (basename) links to $hash_base or HEAD revision of the "raw" blob ("blob_plain" view). If the entity is tree, link to the "tree" view. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Sep 4, 2006 at 18:17 UTC 762c7205f6700070fa3c18c8544a769461b2e567
1 file changed +21 -8
gitweb/gitweb.perl
+21 -8
@@ -1405,19 +1405,32 @@ sub git_print_page_path {
1405
1406 if (!defined $name) {
1407 print "<div class=\"page_path\">/</div>\n";
1408 - } elsif (defined $type && $type eq 'blob') {
1408 + } else {
1409 + my @dirname = split '/', $name;
1410 + my $basename = pop @dirname;
1411 + my $fullname = '';
1412 +
1413 print "<div class=\"page_path\">";
1410 - if (defined $hb) {
1414 + foreach my $dir (@dirname) {
1415 + $fullname .= $dir . '/';
1416 + print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
1417 + hash_base=>$hb),
1418 + -title => $fullname}, esc_html($dir));
1419 + print "/";
1420 + }
1421 + if (defined $type && $type eq 'blob') {
1422 print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
1412 - hash_base=>$hb)},
1413 - esc_html($name));
1423 + hash_base=>$hb),
1424 + -title => $name}, esc_html($basename));
1425 + } elsif (defined $type && $type eq 'tree') {
1426 + print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
1427 + hash_base=>$hb),
1428 + -title => $name}, esc_html($basename));
1429 + print "/";
1430 } else {
1415 - print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name)},
1416 - esc_html($name));
1431 + print esc_html($basename);
1432 }
1433 print "<br/></div>\n";
1419 - } else {
1420 - print "<div class=\"page_path\">" . esc_html($name) . "<br/></div>\n";
1434 }
1435 }
1436