From: Go MAEDA Date: Sat, 25 Jan 2020 09:12:08 +0000 (+0000) Subject: Make breadcrumbs of repository browser copy-paste friendly (#32835). X-Git-Tag: 4.2.0~1245 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5c92383a89c6c6b59763266639f517d362a9c25a;p=redmine.git Make breadcrumbs of repository browser copy-paste friendly (#32835). Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@19460 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/repositories/_breadcrumbs.html.erb b/app/views/repositories/_breadcrumbs.html.erb index 82f25d43a..4a5903e14 100644 --- a/app/views/repositories/_breadcrumbs.html.erb +++ b/app/views/repositories/_breadcrumbs.html.erb @@ -1,31 +1,36 @@ -<%= link_to(@repository.identifier.present? ? @repository.identifier : 'root', - :action => 'show', :id => @project, - :repository_id => @repository.identifier_param, - :path => nil, :rev => @rev) %> <% dirs = path.split('/') if 'file' == kind filename = dirs.pop end + +breadcrumbs = [] +breadcrumbs << link_to( + @repository.identifier.presence || 'root', :action => 'show', + :id => @project, :repository_id => @repository.identifier_param, + :path => nil, :rev => @rev) link_path = '' + dirs.each do |dir| next if dir.blank? + link_path << '/' unless link_path.empty? link_path << "#{dir}" - %> - / <%= link_to dir, :action => 'show', :id => @project, :repository_id => @repository.identifier_param, - :path => to_path_param(link_path), :rev => @rev %> -<% end %> -<% if filename %> - / <%= link_to filename, - :action => 'entry', :id => @project, :repository_id => @repository.identifier_param, - :path => to_path_param("#{link_path}/#{filename}"), :rev => @rev %> -<% end %> + breadcrumbs << link_to(dir, :action => 'show', :id => @project, + :repository_id => @repository.identifier_param, + :path => to_path_param(link_path), :rev => @rev) +end +if filename + breadcrumbs << link_to(filename, :action => 'entry', :id => @project, + :repository_id => @repository.identifier_param, + :path => to_path_param("#{link_path}/#{filename}"), :rev => @rev) +end +%> +<%= breadcrumbs.join(tag.span('/', :class => 'separator')).html_safe -%> <% # @rev is revsion or Git and Mercurial branch or tag. # For Mercurial *tip*, @rev and @changeset are nil. rev_text = @changeset.nil? ? @rev : format_revision(@changeset) %> -<%= "@ #{rev_text}" unless rev_text.blank? %> - -<% html_title(with_leading_slash(path)) -%> +<%= " @ #{rev_text}" unless rev_text.blank? -%> +<% html_title(with_leading_slash(path)) %> diff --git a/app/views/repositories/annotate.html.erb b/app/views/repositories/annotate.html.erb index 038f01eca..829090af6 100644 --- a/app/views/repositories/annotate.html.erb +++ b/app/views/repositories/annotate.html.erb @@ -4,7 +4,7 @@ <%= render :partial => 'navigation' %> -

<%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %>

+ <%= render :partial => 'link_to_functions' %> diff --git a/app/views/repositories/changes.html.erb b/app/views/repositories/changes.html.erb index cd5a95585..96b532073 100644 --- a/app/views/repositories/changes.html.erb +++ b/app/views/repositories/changes.html.erb @@ -4,7 +4,7 @@ <%= render :partial => 'navigation' %> -

<%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %>

+ <%= render :partial => 'link_to_functions' %> diff --git a/app/views/repositories/entry.html.erb b/app/views/repositories/entry.html.erb index 940bb2dc2..99c611104 100644 --- a/app/views/repositories/entry.html.erb +++ b/app/views/repositories/entry.html.erb @@ -4,7 +4,7 @@ <%= render :partial => 'navigation' %> -

<%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %>

+ <%= render :partial => 'link_to_functions' %> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index d96a737ae..adcce9f64 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -4,7 +4,7 @@ <%= render :partial => 'navigation' %> -

<%= render :partial => 'breadcrumbs', +

<% if !@entries.nil? && authorize_for('repositories', 'browse') %> diff --git a/public/stylesheets/scm.css b/public/stylesheets/scm.css index c177b07cc..4640be5f9 100644 --- a/public/stylesheets/scm.css +++ b/public/stylesheets/scm.css @@ -116,3 +116,7 @@ table.annotate td.line-code { background-color: #fafafa; } div.action_M { background: #fd8 } div.action_D { background: #f88 } div.action_A { background: #bfb } + +.breadcrumbs>.separator::before, .breadcrumbs>.separator::after { + content: " "; +}