Re: [PATCH v2 2/2] gitweb: place links to parent directories in page header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Bernhard R. Link" <brl+git@xxxxxxxxxxxxxx> writes:

Description?

> Signed-off-by: Bernhard R. Link <brlink@xxxxxxxxxx>
> 
> ---
> This patch was not yet part of v1.
> 
> I'm not sure this if having this as seperate patch or merged into 1/2
> makes more sense.

While adding links that lead to gitweb URLs with project_filter
parameter set, i.e. linking new feature in, could be postponed to a
later commit, I think some way of notifying client that project list
is filtered would be better to have in 1/2.
 
>  gitweb/gitweb.perl |   23 ++++++++++++++++++++++-
>  1 files changed, 22 insertions(+), 1 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index a114bd4..ddce27d 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -3841,7 +3841,18 @@ sub print_nav_breadcrumbs {
>  
>  	print $cgi->a({-href => esc_url($home_link)}, $home_link_str) . " / ";
>  	if (defined $project) {
> -		print $cgi->a({-href => href(action=>"summary")}, esc_html($project));
> +		my @dirname = split '/', $project;
> +		my $projectbasename = pop @dirname;
> +		my $dirprefix = undef;
> +		while (my $part = shift @dirname) {
> +			$dirprefix .= "/" if defined $dirprefix;
> +			$dirprefix .= $part;
> +			print $cgi->a({-href => href(project => undef,
> +			                             project_filter => $dirprefix,
> +			                             action=>"project_list")},
> +			              esc_html($part)) . " / ";
> +		}
> +		print $cgi->a({-href => href(action=>"summary")}, esc_html($projectbasename));
>  		if (defined $action) {
>  			my $action_print = $action ;
>  			if (defined $opts{-action_extra}) {

Nice solution.

> @@ -3854,6 +3865,16 @@ sub print_nav_breadcrumbs {
>  			print " / $opts{-action_extra}";
>  		}
>  		print "\n";
> +	} elsif (defined $project_filter) {
> +		my @dirname = split '/', $project_filter;
> +		my $dirprefix = undef;
> +		while (my $part = shift @dirname) {
> +			$dirprefix .= "/" if defined $dirprefix;
> +			$dirprefix .= $part;
> +			print $cgi->a({-href => href(project_filter => $dirprefix,
> +			                             action=>"project_list")},
> +			              esc_html($part)) . " / ";
> +		}
>  	}
>  }

Hmmm... I'd have to check how it looks like, but seems like a good
idea... even if there is a little bit of code duplication.

-- 
Jakub Narebski

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]