Class: ActiveAdmin::Views::Menu

Inherits:
Component
  • Object
show all
Defined in:
lib/active_admin/views/components/menu.rb

Overview

Renders an ActiveAdmin::Menu as a set of unordered list items.

This component takes cares of deciding which items should be displayed given the current context and renders them appropriately.

The entire component is rendered within one ul element.

Direct Known Subclasses

TabbedNavigation

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

Returns the value of attribute menu.



12
13
14
# File 'lib/active_admin/views/components/menu.rb', line 12

def menu
  @menu
end

Instance Method Details

#build(menu, options = {}) ⇒ Object

Parameters:

  • menu (ActiveAdmin::Menu)

    the Menu to render

  • options (Hash) (defaults to: {})

    the options as passed to the underlying ul element.



18
19
20
21
22
23
24
25
26
# File 'lib/active_admin/views/components/menu.rb', line 18

def build(menu, options = {})
  @menu = menu
  super(options)

  menu.items.each do |item|
    menu_item(item) if helpers.render_in_context self, item.should_display
  end
  children.sort!
end

#tag_nameObject



28
29
30
# File 'lib/active_admin/views/components/menu.rb', line 28

def tag_name
  "ul"
end