Module: Integrity::Helpers::Breadcrumbs

Included in:
Integrity::Helpers
Defined in:
lib/integrity/helpers/breadcrumbs.rb

Instance Method Summary collapse

Instance Method Details



8
9
10
11
12
13
14
15
16
# File 'lib/integrity/helpers/breadcrumbs.rb', line 8

def breadcrumbs(*crumbs)
  crumbs[0..-2].map do |crumb|
    if page_data = pages.detect {|c| c.first == crumb }
      %Q(<a href="#{page_data.last}">#{page_data.first}</a>)
    elsif @project && @project.permalink == crumb
      %Q(<a href="#{project_path(@project)}">#{@project.permalink}</a>)
    end
  end + [crumbs.last]
end

#pagesObject



4
5
6
# File 'lib/integrity/helpers/breadcrumbs.rb', line 4

def pages
  @pages ||= [["projects", root_path("/")], ["new project", root_path("/new")]]
end