Class: Megatron::BreadcrumbHelper::Breadcrumbs

Inherits:
Helper
  • Object
show all
Defined in:
app/helpers/megatron/breadcrumb_helper.rb

Instance Method Summary collapse

Methods inherited from Helper

inherited

Instance Method Details

#crumb(text = nil, href = nil, options = {}, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/megatron/breadcrumb_helper.rb', line 4

def crumb(text = nil, href = nil, options={}, &block)
  options[:class] = add_class(options[:class], 'breadcrumb')

  if block
    if href.nil?
       :span, options, &block
    else
      link_to href, options, &block
    end
  else
    if href.nil?
      (:span, options) { text.to_s }
    else
      link_to(href, options) { text.to_s }
    end
  end
end

#display(body) ⇒ Object



22
23
24
# File 'app/helpers/megatron/breadcrumb_helper.rb', line 22

def display(body)
  (:nav, class: 'breadcrumbs') { body }
end