Merge pull request #1627 from tsigo/tree_performance

Tree performance improvements
This commit is contained in:
Valeriy Sizov 2012-10-08 05:36:31 -07:00
commit a9cce9358a
10 changed files with 83 additions and 95 deletions

View file

@ -8,14 +8,14 @@ class TreeDecorator < ApplicationDecorator
#parts = parts[0...-1] if is_blob?
yield(h.link_to("..", "#", remote: :true)) if parts.count > max_links
yield(h.link_to("..", "#", remote: true)) if parts.count > max_links
parts.each do |part|
part_path = File.join(part_path, part) unless part_path.empty?
part_path = part if part_path.empty?
next unless parts.last(2).include?(part) if parts.count > max_links
yield(h.link_to(h.truncate(part, length: 40), h.project_tree_path(project, h.tree_join(ref, part_path)), remote: :true))
yield(h.link_to(h.truncate(part, length: 40), h.project_tree_path(project, h.tree_join(ref, part_path)), remote: true))
end
end
end