gitweb: Use href(-replay=>1, action=>...) to generate alternate views

Use href(action=>..., -replay=>1) to generate links to alternate views
of current page in the $formats_nav (bottom) part of page_nav
navigation bar.  This form is used only when all parameters are
repeated, and when the replay form is shorter.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jakub Narebski 2007-11-01 13:06:29 +01:00 committed by Junio C Hamano
parent 7afd77bfc1
commit a3823e5ad7

View File

@ -3911,11 +3911,11 @@ sub git_blame2 {
or die_error(undef, "Open git-blame failed"); or die_error(undef, "Open git-blame failed");
git_header_html(); git_header_html();
my $formats_nav = my $formats_nav =
$cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)}, $cgi->a({-href => href(action=>"blob", -replay=>1)},
"blob") . "blob") .
" | " . " | " .
$cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)}, $cgi->a({-href => href(action=>"history", -replay=>1)},
"history") . "history") .
" | " . " | " .
$cgi->a({-href => href(action=>"blame", file_name=>$file_name)}, $cgi->a({-href => href(action=>"blame", file_name=>$file_name)},
"HEAD"); "HEAD");
@ -4191,18 +4191,15 @@ sub git_blob {
if (defined $file_name) { if (defined $file_name) {
if ($have_blame) { if ($have_blame) {
$formats_nav .= $formats_nav .=
$cgi->a({-href => href(action=>"blame", hash_base=>$hash_base, $cgi->a({-href => href(action=>"blame", -replay=>1)},
hash=>$hash, file_name=>$file_name)},
"blame") . "blame") .
" | "; " | ";
} }
$formats_nav .= $formats_nav .=
$cgi->a({-href => href(action=>"history", hash_base=>$hash_base, $cgi->a({-href => href(action=>"history", -replay=>1)},
hash=>$hash, file_name=>$file_name)},
"history") . "history") .
" | " . " | " .
$cgi->a({-href => href(action=>"blob_plain", $cgi->a({-href => href(action=>"blob_plain", -replay=>1)},
hash=>$hash, file_name=>$file_name)},
"raw") . "raw") .
" | " . " | " .
$cgi->a({-href => href(action=>"blob", $cgi->a({-href => href(action=>"blob",
@ -4210,7 +4207,8 @@ sub git_blob {
"HEAD"); "HEAD");
} else { } else {
$formats_nav .= $formats_nav .=
$cgi->a({-href => href(action=>"blob_plain", hash=>$hash)}, "raw"); $cgi->a({-href => href(action=>"blob_plain", -replay=>1)},
"raw");
} }
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav); git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
git_print_header_div('commit', esc_html($co{'title'}), $hash_base); git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
@ -4273,8 +4271,7 @@ sub git_tree {
my @views_nav = (); my @views_nav = ();
if (defined $file_name) { if (defined $file_name) {
push @views_nav, push @views_nav,
$cgi->a({-href => href(action=>"history", hash_base=>$hash_base, $cgi->a({-href => href(action=>"history", -replay=>1)},
hash=>$hash, file_name=>$file_name)},
"history"), "history"),
$cgi->a({-href => href(action=>"tree", $cgi->a({-href => href(action=>"tree",
hash_base=>"HEAD", file_name=>$file_name)}, hash_base=>"HEAD", file_name=>$file_name)},
@ -4742,10 +4739,7 @@ sub git_blobdiff {
# header # header
if ($format eq 'html') { if ($format eq 'html') {
my $formats_nav = my $formats_nav =
$cgi->a({-href => href(action=>"blobdiff_plain", $cgi->a({-href => href(action=>"blobdiff_plain", -replay=>1)},
hash=>$hash, hash_parent=>$hash_parent,
hash_base=>$hash_base, hash_parent_base=>$hash_parent_base,
file_name=>$file_name, file_parent=>$file_parent)},
"raw"); "raw");
git_header_html(undef, $expires); git_header_html(undef, $expires);
if (defined $hash_base && (my %co = parse_commit($hash_base))) { if (defined $hash_base && (my %co = parse_commit($hash_base))) {
@ -4819,8 +4813,7 @@ sub git_commitdiff {
my $formats_nav; my $formats_nav;
if ($format eq 'html') { if ($format eq 'html') {
$formats_nav = $formats_nav =
$cgi->a({-href => href(action=>"commitdiff_plain", $cgi->a({-href => href(action=>"commitdiff_plain", -replay=>1)},
hash=>$hash, hash_parent=>$hash_parent)},
"raw"); "raw");
if (defined $hash_parent && if (defined $hash_parent &&