Module: Goose::Helper

Defined in:
lib/goose/helper.rb

Instance Method Summary collapse

Instance Method Details



30
31
32
33
34
35
36
37
38
# File 'lib/goose/helper.rb', line 30

def breadcrumbs
  goose.current_address.map do |crumb|
    if crumb.is_a?(Array)
      Goose.config.breadcrumb_linker.call(self, *crumb)
    else
      crumb
    end
  end
end

#gooseObject



5
6
7
# File 'lib/goose/helper.rb', line 5

def goose
  @goose ||= State.new(self)
end


26
27
28
# File 'lib/goose/helper.rb', line 26

def nav(name = nil)
  nav_at(nil, :in => name)
end


19
20
21
22
23
24
# File 'lib/goose/helper.rb', line 19

def nav_at(*places)
  options = places.last.is_a?(Hash) ? places.pop : {}
  nav = options[:in] || :main
  address = Address.new(*places)
  goose.render(nav, address)
end


9
10
11
12
13
14
15
16
17
# File 'lib/goose/helper.rb', line 9

def nav_to(place, url, options = {}, &block)
  if goose.at?(place)
    goose.current_address.resolve(url)
    options.update(Goose.config.active_options)
  end
  content = url ? link_to(place, url) : ''
  content << capture(&block) if block
  (Goose.config.wrapper_tag, content, options)
end