Last active
August 29, 2015 14:05
-
-
Save gotva/7f6848ec94462948b5d4 to your computer and use it in GitHub Desktop.
Project tree names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#view | |
#<h3>Project Tree: <%= project_nested_tree_name(issue.project) %></h3> | |
# helper | |
def project_nested_tree_name(project) | |
if project.parent | |
nested_parent_names(project).flatten.join(" > ") | |
else | |
"" | |
end.html_safe | |
end | |
private | |
def nested_parent_names(project) | |
result = [project.name] | |
result << nested_parent_names(project.parent) if project.parent | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment