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
This commit is contained in:
Go MAEDA
2020-01-25 09:12:08 +00:00
parent 8dbbfd6172
commit 5c92383a89
6 changed files with 29 additions and 20 deletions

View File

@@ -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)) %>

View File

@@ -4,7 +4,7 @@
<%= render :partial => 'navigation' %>
</div>
<h2><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
<h2 class="breadcrumbs"><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
<%= render :partial => 'link_to_functions' %>

View File

@@ -4,7 +4,7 @@
<%= render :partial => 'navigation' %>
</div>
<h2><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
<h2 class="breadcrumbs"><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
<%= render :partial => 'link_to_functions' %>

View File

@@ -4,7 +4,7 @@
<%= render :partial => 'navigation' %>
</div>
<h2><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
<h2 class="breadcrumbs"><%= render :partial => 'breadcrumbs', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
<%= render :partial => 'link_to_functions' %>

View File

@@ -4,7 +4,7 @@
<%= render :partial => 'navigation' %>
</div>
<h2><%= render :partial => 'breadcrumbs',
<h2 class="breadcrumbs"><%= render :partial => 'breadcrumbs',
:locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>
<% if !@entries.nil? && authorize_for('repositories', 'browse') %>