Aura Aura Menu

Menu

A menu.

Accessing the singleton

Doing Aura.admin.menu will get you the single instance of Aura::Menu.

m = Aura.admin.menu    #=> #<Aura::Menu ...>

Adding menu items

Use Aura::Menu#add.

Aura.admin.menu.add "hello",
  :name => "Hello",
  :href => '/admin/lol',
  :icon => 'settings'

Adding submenu items

Add sub items by using the dot notation on the name.

Aura.admin.menu.add "hello.subitem",
  :name => "Subitem",
  :href => '/admin/lol/sub',
  :icon => 'settings'

Retrieving menu items

Use items (Aura::Menu).

Aura.admin.menu.items    #=> Array of MenuItems

item = Aura.admin.menu.get('hello')
item.name
item.href
item.icon
item.items    # List of sub items

Methods

  • add Adds a menu item.
  • get Returns a menu item of a given key.
  • items Returns the root menu items.