##// END OF EJS Templates
Linkify folder names on revision view (#5164)....
Jean-Philippe Lang -
r3545:2674c6116cad
parent child
Show More
@@ -52,17 +52,19 module RepositoriesHelper
52 else
52 else
53 change
53 change
54 end
54 end
55 end.compact
55 end.compact
56
56
57 tree = { }
57 tree = { }
58 changes.each do |change|
58 changes.each do |change|
59 p = tree
59 p = tree
60 dirs = change.path.to_s.split('/').select {|d| !d.blank?}
60 dirs = change.path.to_s.split('/').select {|d| !d.blank?}
61 path = ''
61 dirs.each do |dir|
62 dirs.each do |dir|
63 path += '/' + dir
62 p[:s] ||= {}
64 p[:s] ||= {}
63 p = p[:s]
65 p = p[:s]
64 p[dir] ||= {}
66 p[path] ||= {}
65 p = p[dir]
67 p = p[path]
66 end
68 end
67 p[:c] = change
69 p[:c] = change
68 end
70 end
@@ -76,21 +78,26 module RepositoriesHelper
76 output = ''
78 output = ''
77 output << '<ul>'
79 output << '<ul>'
78 tree.keys.sort.each do |file|
80 tree.keys.sort.each do |file|
79 s = !tree[file][:s].nil?
80 c = tree[file][:c]
81
82 style = 'change'
81 style = 'change'
83 style << ' folder' if s
82 text = File.basename(h(file))
84 style << " change-#{c.action}" if c
83 if s = tree[file][:s]
85
84 style << ' folder'
86 text = h(file)
85 path_param = to_path_param(@repository.relative_path(file))
87 unless c.nil?
86 text = link_to(text, :controller => 'repositories',
87 :action => 'show',
88 :id => @project,
89 :path => path_param,
90 :rev => @changeset.revision)
91 output << "<li class='#{style}'>#{text}</li>"
92 output << render_changes_tree(s)
93 elsif c = tree[file][:c]
94 style << " change-#{c.action}"
88 path_param = to_path_param(@repository.relative_path(c.path))
95 path_param = to_path_param(@repository.relative_path(c.path))
89 text = link_to(text, :controller => 'repositories',
96 text = link_to(text, :controller => 'repositories',
90 :action => 'entry',
97 :action => 'entry',
91 :id => @project,
98 :id => @project,
92 :path => path_param,
99 :path => path_param,
93 :rev => @changeset.revision) unless s || c.action == 'D'
100 :rev => @changeset.revision) unless c.action == 'D'
94 text << " - #{c.revision}" unless c.revision.blank?
101 text << " - #{c.revision}" unless c.revision.blank?
95 text << ' (' + link_to('diff', :controller => 'repositories',
102 text << ' (' + link_to('diff', :controller => 'repositories',
96 :action => 'diff',
103 :action => 'diff',
@@ -98,9 +105,8 module RepositoriesHelper
98 :path => path_param,
105 :path => path_param,
99 :rev => @changeset.revision) + ') ' if c.action == 'M'
106 :rev => @changeset.revision) + ') ' if c.action == 'M'
100 text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank?
107 text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank?
108 output << "<li class='#{style}'>#{text}</li>"
101 end
109 end
102 output << "<li class='#{style}'>#{text}</li>"
103 output << render_changes_tree(tree[file][:s]) if s
104 end
110 end
105 output << '</ul>'
111 output << '</ul>'
106 output
112 output
General Comments 0
You need to be logged in to leave comments. Login now