To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / app / helpers / repositories_helper.rb.rej @ 420:2008fa7fda29

History | View | Annotate | Download (2.53 KB)

1
--- app/helpers/repositories_helper.rb
2
+++ app/helpers/repositories_helper.rb
3
@@ -52,17 +52,19 @@
4
       else
5
         change
6
       end
7
-    end.compact
8
+   end.compact
9
     
10
     tree = { }
11
     changes.each do |change|
12
       p = tree
13
       dirs = change.path.to_s.split('/').select {|d| !d.blank?}
14
+      path = ''
15
       dirs.each do |dir|
16
+        path += '/' + dir
17
         p[:s] ||= {}
18
         p = p[:s]
19
-        p[dir] ||= {}
20
-        p = p[dir]
21
+        p[path] ||= {}
22
+        p = p[path]
23
       end
24
       p[:c] = change
25
     end
26
@@ -76,21 +78,26 @@
27
     output = ''
28
     output << '<ul>'
29
     tree.keys.sort.each do |file|
30
-      s = !tree[file][:s].nil?
31
-      c = tree[file][:c]
32
-      
33
       style = 'change'
34
-      style << ' folder' if s
35
-      style << " change-#{c.action}" if c
36
-      
37
-      text = h(file)
38
-      unless c.nil?
39
+      text = File.basename(h(file))
40
+      if s = tree[file][:s]
41
+        style << ' folder'
42
+        path_param = to_path_param(@repository.relative_path(file))
43
+        text = link_to(text, :controller => 'repositories',
44
+                             :action => 'show',
45
+                             :id => @project,
46
+                             :path => path_param,
47
+                             :rev => @changeset.revision)
48
+        output << "<li class='#{style}'>#{text}</li>"
49
+        output << render_changes_tree(s)
50
+      elsif c = tree[file][:c]
51
+        style << " change-#{c.action}"
52
         path_param = to_path_param(@repository.relative_path(c.path))
53
         text = link_to(text, :controller => 'repositories',
54
                              :action => 'entry',
55
                              :id => @project,
56
                              :path => path_param,
57
-                             :rev => @changeset.revision) unless s || c.action == 'D'
58
+                             :rev => @changeset.revision) unless c.action == 'D'
59
         text << " - #{c.revision}" unless c.revision.blank?
60
         text << ' (' + link_to('diff', :controller => 'repositories',
61
                                        :action => 'diff',
62
@@ -98,9 +105,8 @@
63
                                        :path => path_param,
64
                                        :rev => @changeset.revision) + ') ' if c.action == 'M'
65
         text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank?
66
+        output << "<li class='#{style}'>#{text}</li>"
67
       end
68
-      output << "<li class='#{style}'>#{text}</li>"
69
-      output << render_changes_tree(tree[file][:s]) if s
70
     end
71
     output << '</ul>'
72
     output