rosa-build/app/helpers/contents_helper.rb

26 lines
685 B
Ruby
Raw Normal View History

module ContentsHelper
def build_content_paths(platform, path)
paths = ['/']
paths |= path.split('/').select(&:present?)
paths.uniq!
compound_path = ''
paths.map do |p|
compound_path << p << '/' if p != '/'
2014-01-21 04:51:49 +00:00
link_to(platform_content_path(platform, compound_path), {remote: true}) do
content_tag(:span, p, {class: 'text'}) +
content_tag(:span, '', {class: 'arrow-right'})
end
end.join.html_safe
end
def platform_content_path(platform, path, name = nil)
full_path = platform_contents_path(platform)
full_path << '/' << path if path.present?
full_path << ('/' << name) if name.present?
full_path
end
end