Class: Panda::CMS::MenuComponent

Inherits:
Panda::Core::Base
  • Object
show all
Defined in:
app/components/panda/cms/menu_component.rb

Overview

Menu component for rendering navigational menus

Instance Method Summary collapse

Instance Method Details

#before_templateObject



37
38
39
# File 'app/components/panda/cms/menu_component.rb', line 37

def before_template
  load_menu_items
end

#view_templateObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/components/panda/cms/menu_component.rb', line 20

def view_template
  return unless @menu

  @processed_menu_items.each do |menu_item|
    a(href: menu_item.resolved_link, class: menu_item.css_classes) { menu_item.text }

    if @render_page_menu && menu_item.page
      render Panda::CMS::PageMenuComponent.new(
        page: menu_item.page,
        start_depth: 1,
        styles: @page_menu_styles,
        show_heading: false
      )
    end
  end
end