2013-07-08 11:39:44 +01:00
|
|
|
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'})
|
2013-07-08 11:39:44 +01:00
|
|
|
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
|