Module: Merb::Breadcrumbs::Helpers

Included in:
GlobalHelpers
Defined in:
lib/merb-breadcrumbs/helpers.rb

Instance Method Summary collapse

Instance Method Details



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/merb-breadcrumbs/helpers.rb', line 4

def breadcrumb_links(join=' » ')
  crumbs = self.breadcrumbs.dup
  last = crumbs.pop
  crumbs.map! do |text, link|
    if link.nil?
      tag :a, text
    else
      link_to(text, link)
    end
  end
  text, link = last
  if link.nil? or link == url(:this)
    crumbs << tag(:a, text)
  else
    crumbs << link_to(text, link)
  end
  crumbs.join(join)
end