13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/helpers/bulb/application_helper.rb', line 13
def breadcrumb
parts = params[:path].split("/")
last = parts.pop
reference = params[:reference]
group_slug = params[:group_slug]
slug = params[:slug]
elements = []
elements << content_tag(:li) do
link_to @repository.slug, bulb.repository_path(group_slug, slug)
end
parts.each_with_index do |part, index|
path = parts[0..index].join("/")
elements << content_tag(:li) do
link_to part, bulb.repository_tree_path(reference: reference, path: path)
end
end
elements << content_tag(:li, last)
content_tag(:ul, elements.join.html_safe, class: 'breadcrumb')
end
|