Module: HappyNav

Defined in:
lib/happy-nav.rb,
lib/happy-nav/railtie.rb

Defined Under Namespace

Classes: Railtie

Instance Method Summary collapse

Instance Method Details

#current_page(page = nil) ⇒ Object



17
18
19
20
21
# File 'lib/happy-nav.rb', line 17

def current_page(page = nil)
  @current_pages ||= []
  @current_pages << page if page
  @current_pages.first
end


6
7
8
9
10
11
12
13
14
15
# File 'lib/happy-nav.rb', line 6

def navigation(items = [], options = {})
  unless items.empty?
    @navigation_presenter = NavigationPresenter.new(items, options)
    if @current_pages
      @current_pages.each { |page| @navigation_presenter.current_item(page) }
    end
    @navigation = @navigation_presenter.to_html
  end
  @navigation ||= ''
end