From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH 3/4] gitweb: Divide page path into directories -- path's "breadcrumbs"
Date: Mon, 4 Sep 2006 18:17:58 +0200 [thread overview]
Message-ID: <200609041817.59054.jnareb@gmail.com> (raw)
In-Reply-To: <200609041810.09838.jnareb@gmail.com>
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>
---
gitweb/gitweb.perl | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3b5c0e2..4240a30 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1375,19 +1375,32 @@ sub git_print_page_path {
if (!defined $name) {
print "<div class=\"page_path\">/</div>\n";
- } elsif (defined $type && $type eq 'blob') {
+ } else {
+ my @dirname = split '/', $name;
+ my $basename = pop @dirname;
+ my $fullname = '';
+
print "<div class=\"page_path\">";
- if (defined $hb) {
+ foreach my $dir (@dirname) {
+ $fullname .= $dir . '/';
+ print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
+ hash_base=>$hb),
+ -title => $fullname}, esc_html($dir));
+ print "/";
+ }
+ if (defined $type && $type eq 'blob') {
print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
- hash_base=>$hb)},
- esc_html($name));
+ hash_base=>$hb),
+ -title => $name}, esc_html($basename));
+ } elsif (defined $type && $type eq 'tree') {
+ print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
+ hash_base=>$hb),
+ -title => $name}, esc_html($basename));
+ print "/";
} else {
- print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name)},
- esc_html($name));
+ print esc_html($basename);
}
print "<br/></div>\n";
- } else {
- print "<div class=\"page_path\">" . esc_html($name) . "<br/></div>\n";
}
}
--
1.4.1.1
next prev parent reply other threads:[~2006-09-04 16:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-04 16:10 [PATCH 0/4] gitweb: Some improvements Jakub Narebski
2006-09-04 16:13 ` PATCH 1/4] gitweb: Add GIT favicon, assuming image/png type Jakub Narebski
2006-09-04 17:15 ` Linus Torvalds
2006-09-04 18:32 ` [PATCH " Jakub Narebski
2006-09-04 18:34 ` Jakub Narebski
2006-09-04 22:46 ` Junio C Hamano
2006-09-04 23:00 ` Jakub Narebski
2006-09-04 23:17 ` Junio C Hamano
2006-09-04 16:15 ` [PATCH 2/4] gitweb: Change the name of diff to parent link in "commit" view to "diff" Jakub Narebski
2006-09-04 16:17 ` Jakub Narebski [this message]
2006-09-04 16:19 ` [PATCH 4/4] gitweb: Correct typo: '==' instead of 'eq' in git_difftree_body Jakub Narebski
2006-09-04 23:22 ` [PATCH 0/4] gitweb: Some improvements Junio C Hamano
2006-09-04 23:53 ` Jakub Narebski
2006-09-05 8:59 ` gitweb testing and benchmarking (was: [PATCH 0/4] gitweb: Some improvements) Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200609041817.59054.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).