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


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

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.


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

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


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

def tag_name
  'ul'
end