Module: Bulb::ApplicationHelper

Defined in:
app/helpers/bulb/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#blob_path(root, name) ⇒ Object



8
9
10
11
# File 'app/helpers/bulb/application_helper.rb', line 8

def blob_path(root, name)
  root = root ? (root + "/") : ""
  bulb.repository_blob_path(reference: 'master', path: root + name)
end


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 << (: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 << (:li) do
      link_to part, bulb.repository_tree_path(reference: reference, path: path)
    end
  end

  elements << (:li, last)

  (:ul, elements.join.html_safe, class: 'breadcrumb')
end

#tree_path(root, name) ⇒ Object



3
4
5
6
# File 'app/helpers/bulb/application_helper.rb', line 3

def tree_path(root, name)
  root = root ? (root + "/") : ""
  bulb.repository_tree_path(reference: 'master', path: root + name)
end