gitweb: allow action specialization in page header
An optional -action_extra parameter is given to git_header_html() to identify a variant of the action that is being displayed. For example, this can be used to specify that the remotes view is being used for a specific remote and not to display all remotes. When -action_extra is provided, the action name in the header will be turned into a link to the action without any arguments or parameters, to provide a quick link to the non-specific variant of the action. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Giuseppe Bilotta committed
Nov 11, 2010 at 13:26 UTC
c7d94cdbe7ed29a0e26645fa4bb30d87755d86aa
1 file changed
+9
-1
gitweb/gitweb.perl
+9
-1
@@ -3526,7 +3526,15 @@ EOF
3526
if (defined $project) {
3527
print $cgi->a({-href => href(action=>"summary")}, esc_html($project));
3528
if (defined $action) {
3529
- print " / $action";
3529
+ my $action_print = $action ;
3530
+ if (defined $opts{-action_extra}) {
3531
+ $action_print = $cgi->a({-href => href(action=>$action)},
3532
+ $action);
3533
+ }
3534
+ print " / $action_print";
3535
+ }
3536
+ if (defined $opts{-action_extra}) {
3537
+ print " / $opts{-action_extra}";
3538
}
3539
print "\n";
3540
}