Skip to content

Instantly share code, notes, and snippets.

@Sylvain303
Last active August 29, 2015 14:08
Show Gist options
  • Save Sylvain303/c288ed7153ad98dc93fc to your computer and use it in GitHub Desktop.
Save Sylvain303/c288ed7153ad98dc93fc to your computer and use it in GitHub Desktop.
modified render_email_issue_attributes() redmine helper
def render_email_issue_attributes(issue, user, html=false)
exclude = %w{category fixed_version}
items = email_issue_attributes(issue, user)
# filter items outputed
items = items.select {|i| ! exclude.include?(i) }
output = []
# content_tag() will escape if it recieve string not block
items.each do |i|
if html
output << content_tag('li', i)
else
output << "* #{i}"
end
end
if html
output = content_tag('ul', output.join("\n").html_safe) if html
else
output = output.join("\n")
end
return output
end
# was
def render_email_issue_attributes(issue, user, html=false)
exclude = %w{category fixed_version}
items = email_issue_attributes(issue, user)
items = items.select {|i| ! exclude.include?(i) }
if html
content_tag('ul', items.map{|s| content_tag('li', s)}.join("\n").html_safe)
else
items.map{|s| "* #{s}"}.join("\n")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment