Adds projects association on tracker form (#2578).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2335 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-01-29 14:22:56 +00:00
parent 32d4378198
commit 945ec8942a
7 changed files with 119 additions and 5 deletions
+24
View File
@@ -195,6 +195,30 @@ module ApplicationHelper
ancestors << project
end
end
def project_nested_ul(projects, &block)
s = ''
if projects.any?
ancestors = []
projects.sort_by(&:lft).each do |project|
if (ancestors.empty? || project.is_descendant_of?(ancestors.last))
s << "<ul>\n"
else
ancestors.pop
s << "</li>"
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
ancestors.pop
s << "</ul></li>\n"
end
end
s << "<li>"
s << yield(project).to_s
ancestors << project
end
s << ("</li></ul>\n" * ancestors.size)
end
s
end
# Truncates and returns the string as a single line
def truncate_single_line(string, *args)