@matheusbsbs / matheus-bagliano / commits / a3823e5ad7
Fork 0

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>

Jakub Narebski committed Nov 1, 2007 at 13:06 UTC a3823e5ad75498774a32850f44e8254b0e1c0901
1 file changed +11 -18
gitweb/gitweb.perl
+11 -18
@@ -3911,11 +3911,11 @@ sub git_blame2 {
3911 or die_error(undef, "Open git-blame failed");
3912 git_header_html();
3913 my $formats_nav =
3914 - $cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
3914 + $cgi->a({-href => href(action=>"blob", -replay=>1)},
3915 "blob") .
3916 " | " .
3917 - $cgi->a({-href => href(action=>"history", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
3918 - "history") .
3917 + $cgi->a({-href => href(action=>"history", -replay=>1)},
3918 + "history") .
3919 " | " .
3920 $cgi->a({-href => href(action=>"blame", file_name=>$file_name)},
3921 "HEAD");
@@ -4191,18 +4191,15 @@ sub git_blob {
4191 if (defined $file_name) {
4192 if ($have_blame) {
4193 $formats_nav .=
4194 - $cgi->a({-href => href(action=>"blame", hash_base=>$hash_base,
4195 - hash=>$hash, file_name=>$file_name)},
4194 + $cgi->a({-href => href(action=>"blame", -replay=>1)},
4195 "blame") .
4196 " | ";
4197 }
4198 $formats_nav .=
4200 - $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
4201 - hash=>$hash, file_name=>$file_name)},
4199 + $cgi->a({-href => href(action=>"history", -replay=>1)},
4200 "history") .
4201 " | " .
4204 - $cgi->a({-href => href(action=>"blob_plain",
4205 - hash=>$hash, file_name=>$file_name)},
4202 + $cgi->a({-href => href(action=>"blob_plain", -replay=>1)},
4203 "raw") .
4204 " | " .
4205 $cgi->a({-href => href(action=>"blob",
@@ -4210,7 +4207,8 @@ sub git_blob {
4207 "HEAD");
4208 } else {
4209 $formats_nav .=
4213 - $cgi->a({-href => href(action=>"blob_plain", hash=>$hash)}, "raw");
4210 + $cgi->a({-href => href(action=>"blob_plain", -replay=>1)},
4211 + "raw");
4212 }
4213 git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
4214 git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
@@ -4273,8 +4271,7 @@ sub git_tree {
4271 my @views_nav = ();
4272 if (defined $file_name) {
4273 push @views_nav,
4276 - $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
4277 - hash=>$hash, file_name=>$file_name)},
4274 + $cgi->a({-href => href(action=>"history", -replay=>1)},
4275 "history"),
4276 $cgi->a({-href => href(action=>"tree",
4277 hash_base=>"HEAD", file_name=>$file_name)},
@@ -4742,10 +4739,7 @@ sub git_blobdiff {
4739 # header
4740 if ($format eq 'html') {
4741 my $formats_nav =
4745 - $cgi->a({-href => href(action=>"blobdiff_plain",
4746 - hash=>$hash, hash_parent=>$hash_parent,
4747 - hash_base=>$hash_base, hash_parent_base=>$hash_parent_base,
4748 - file_name=>$file_name, file_parent=>$file_parent)},
4742 + $cgi->a({-href => href(action=>"blobdiff_plain", -replay=>1)},
4743 "raw");
4744 git_header_html(undef, $expires);
4745 if (defined $hash_base && (my %co = parse_commit($hash_base))) {
@@ -4819,8 +4813,7 @@ sub git_commitdiff {
4813 my $formats_nav;
4814 if ($format eq 'html') {
4815 $formats_nav =
4822 - $cgi->a({-href => href(action=>"commitdiff_plain",
4823 - hash=>$hash, hash_parent=>$hash_parent)},
4816 + $cgi->a({-href => href(action=>"commitdiff_plain", -replay=>1)},
4817 "raw");
4818
4819 if (defined $hash_parent &&