Re: [PATCH v2 2/2] gitweb: place links to parent directories in page header
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Jan 28, 2012, 22:54 UTC
- Message-ID
- <m3sjizcu8x.fsf@localhost.localdomain>
- In-Reply-To
- <20120128165753.GA6795@server.brlink.eu>
"Bernhard R. Link" <brl+git@mail.brlink.eu> writes:
Description?
Show 7 quoted lines
> Signed-off-by: Bernhard R. Link <brlink@debian.org> > > --- > 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.
Show 27 quoted lines
> 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.
Show 16 quoted lines
> @@ -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