Created
March 7, 2014 08:13
-
-
Save dvander/9407433 to your computer and use it in GitHub Desktop.
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
# Render "namespace / project" where both components are separate links. | |
def render_project_link project | |
if !project.namespace | |
return link_to_project project do | |
project.name | |
end | |
end | |
if project.namespace.type == 'Group' | |
html = link_to group_path(id: project.namespace.path), class: 'group' do | |
content_tag(:span, "#{project.namespace.name}", class: 'group-name') | |
end | |
else | |
html = link_to user_path(project.namespace.path), class: 'user' do | |
content_tag(:span, "#{project.namespace.name}", class: 'user-name') | |
end | |
end | |
html << content_tag(:span, "/") | |
html << (link_to project_path(project) do | |
content_tag(:span, "#{project.name}", class: 'project-name') | |
end) | |
return html | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment