Save 2 queries when displaying a root issue.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5244 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-03-28 20:32:35 +00:00
parent 1c03b418e1
commit ba0c9069ed
1 changed files with 3 additions and 2 deletions

View File

@ -57,11 +57,12 @@ module IssuesHelper
def render_issue_subject_with_tree(issue) def render_issue_subject_with_tree(issue)
s = '' s = ''
issue.ancestors.each do |ancestor| ancestors = issue.root? ? [] : issue.ancestors.all
ancestors.each do |ancestor|
s << '<div>' + content_tag('p', link_to_issue(ancestor)) s << '<div>' + content_tag('p', link_to_issue(ancestor))
end end
s << '<div>' + content_tag('h3', h(issue.subject)) s << '<div>' + content_tag('h3', h(issue.subject))
s << '</div>' * (issue.ancestors.size + 1) s << '</div>' * (ancestors.size + 1)
s s
end end