Module: VerticalNavHelper

Defined in:
app/helpers/vertical_nav_helper.rb

Instance Method Summary collapse

Instance Method Details

#show_vertical_nav?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/helpers/vertical_nav_helper.rb', line 25

def show_vertical_nav?
  @navable.present?
end

#vertical_menu_for(navable) ⇒ Object

Generates the HTML code for a vertical menu, where the given navable object, e.g. a Page or a User, is the currently active element.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/vertical_nav_helper.rb', line 12

def vertical_menu_for(navable)
  if navable
    @ancestor_navables = cached_ancestor_navables(navable)
    @active_navable = navable
    @active_navables = [@active_navable]
    @child_navables = cached_child_navables(navable)
    
    menu_elements_html(@ancestor_navables, :ancestor) +
    menu_element(@active_navable, :active) +
    menu_elements_html(@child_navables, :child)
  end
end

#vertical_navObject

Returns the html code for the vertical navigation, i.e. the vertical menu.



5
6
7
# File 'app/helpers/vertical_nav_helper.rb', line 5

def vertical_nav
  render partial: 'layouts/vertical_nav'
end