diff options
author | Go MAEDA <maeda@farend.jp> | 2020-01-25 09:12:08 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-01-25 09:12:08 +0000 |
commit | 5c92383a89c6c6b59763266639f517d362a9c25a (patch) | |
tree | c2608a093cf6f0308e8a3d8b21a5d1da19eeea76 | |
parent | 8dbbfd61725577fb45faa5dbd0cbccf252aa6417 (diff) | |
download | redmine-5c92383a89c6c6b59763266639f517d362a9c25a.tar.gz redmine-5c92383a89c6c6b59763266639f517d362a9c25a.zip |
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
-rw-r--r-- | app/views/repositories/_breadcrumbs.html.erb | 37 | ||||
-rw-r--r-- | app/views/repositories/annotate.html.erb | 2 | ||||
-rw-r--r-- | app/views/repositories/changes.html.erb | 2 | ||||
-rw-r--r-- | app/views/repositories/entry.html.erb | 2 | ||||
-rw-r--r-- | app/views/repositories/show.html.erb | 2 | ||||
-rw-r--r-- | public/stylesheets/scm.css | 4 |
6 files changed, 29 insertions, 20 deletions
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' %> </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' %> 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' %> </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' %> 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' %> </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' %> 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' %> </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') %> 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: " "; +} |