module IssuesHelper
include ApplicationHelper
def issue_list(issues, &block)
ancestors = []
issues.each do |issue|
while (ancestors.any? && !issue.is_descendant_of?(ancestors.last))
ancestors.pop
end
yield issue, ancestors.size
ancestors << issue unless issue.leaf?
end
end
# Renders a HTML/CSS tooltip
#
# To use, a trigger div is needed. This is a div with the class of "tooltip"
# that contains this method wrapped in a span with the class of "tip"
#
#
<%= link_to_issue(issue) %>
# <%= render_issue_tooltip(issue) %>
#
#
def render_issue_tooltip(issue)
@cached_label_status ||= l(:field_status)
@cached_label_start_date ||= l(:field_start_date)
@cached_label_due_date ||= l(:field_due_date)
@cached_label_assigned_to ||= l(:field_assigned_to)
@cached_label_priority ||= l(:field_priority)
@cached_label_project ||= l(:field_project)
link_to_issue(issue) + "
" +
"#{@cached_label_project}: #{link_to_project(issue.project)}
" +
"#{@cached_label_status}: #{issue.status.name}
" +
"#{@cached_label_start_date}: #{format_date(issue.start_date)}
" +
"#{@cached_label_due_date}: #{format_date(issue.due_date)}
" +
"#{@cached_label_assigned_to}: #{issue.assigned_to}
" +
"#{@cached_label_priority}: #{issue.priority.name}"
end
def render_issue_subject_with_tree(issue)
s = ''
ancestors = issue.root? ? [] : issue.ancestors.all
ancestors.each do |ancestor|
s << '' + content_tag('p', link_to_issue(ancestor))
end
s << '
' + content_tag('h3', h(issue.subject))
s << '
' * (ancestors.size + 1)
s
end
def render_descendants_tree(issue)
s = '