Linkify folder names on revision view (#5164).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3659 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5163904a3a
commit
2674c6116c
@ -52,17 +52,19 @@ module RepositoriesHelper
|
|||||||
else
|
else
|
||||||
change
|
change
|
||||||
end
|
end
|
||||||
end.compact
|
end.compact
|
||||||
|
|
||||||
tree = { }
|
tree = { }
|
||||||
changes.each do |change|
|
changes.each do |change|
|
||||||
p = tree
|
p = tree
|
||||||
dirs = change.path.to_s.split('/').select {|d| !d.blank?}
|
dirs = change.path.to_s.split('/').select {|d| !d.blank?}
|
||||||
|
path = ''
|
||||||
dirs.each do |dir|
|
dirs.each do |dir|
|
||||||
|
path += '/' + dir
|
||||||
p[:s] ||= {}
|
p[:s] ||= {}
|
||||||
p = p[:s]
|
p = p[:s]
|
||||||
p[dir] ||= {}
|
p[path] ||= {}
|
||||||
p = p[dir]
|
p = p[path]
|
||||||
end
|
end
|
||||||
p[:c] = change
|
p[:c] = change
|
||||||
end
|
end
|
||||||
@ -76,21 +78,26 @@ module RepositoriesHelper
|
|||||||
output = ''
|
output = ''
|
||||||
output << '<ul>'
|
output << '<ul>'
|
||||||
tree.keys.sort.each do |file|
|
tree.keys.sort.each do |file|
|
||||||
s = !tree[file][:s].nil?
|
|
||||||
c = tree[file][:c]
|
|
||||||
|
|
||||||
style = 'change'
|
style = 'change'
|
||||||
style << ' folder' if s
|
text = File.basename(h(file))
|
||||||
style << " change-#{c.action}" if c
|
if s = tree[file][:s]
|
||||||
|
style << ' folder'
|
||||||
text = h(file)
|
path_param = to_path_param(@repository.relative_path(file))
|
||||||
unless c.nil?
|
text = link_to(text, :controller => 'repositories',
|
||||||
|
:action => 'show',
|
||||||
|
:id => @project,
|
||||||
|
:path => path_param,
|
||||||
|
:rev => @changeset.revision)
|
||||||
|
output << "<li class='#{style}'>#{text}</li>"
|
||||||
|
output << render_changes_tree(s)
|
||||||
|
elsif c = tree[file][:c]
|
||||||
|
style << " change-#{c.action}"
|
||||||
path_param = to_path_param(@repository.relative_path(c.path))
|
path_param = to_path_param(@repository.relative_path(c.path))
|
||||||
text = link_to(text, :controller => 'repositories',
|
text = link_to(text, :controller => 'repositories',
|
||||||
:action => 'entry',
|
:action => 'entry',
|
||||||
:id => @project,
|
:id => @project,
|
||||||
:path => path_param,
|
:path => path_param,
|
||||||
:rev => @changeset.revision) unless s || c.action == 'D'
|
:rev => @changeset.revision) unless c.action == 'D'
|
||||||
text << " - #{c.revision}" unless c.revision.blank?
|
text << " - #{c.revision}" unless c.revision.blank?
|
||||||
text << ' (' + link_to('diff', :controller => 'repositories',
|
text << ' (' + link_to('diff', :controller => 'repositories',
|
||||||
:action => 'diff',
|
:action => 'diff',
|
||||||
@ -98,9 +105,8 @@ module RepositoriesHelper
|
|||||||
:path => path_param,
|
:path => path_param,
|
||||||
:rev => @changeset.revision) + ') ' if c.action == 'M'
|
:rev => @changeset.revision) + ') ' if c.action == 'M'
|
||||||
text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank?
|
text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank?
|
||||||
|
output << "<li class='#{style}'>#{text}</li>"
|
||||||
end
|
end
|
||||||
output << "<li class='#{style}'>#{text}</li>"
|
|
||||||
output << render_changes_tree(tree[file][:s]) if s
|
|
||||||
end
|
end
|
||||||
output << '</ul>'
|
output << '</ul>'
|
||||||
output
|
output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user