Class: ActiveAdmin::Views::TabbedNavigation

Inherits:
Component
  • Object
show all
Defined in:
lib/active_admin/views/tabbed_navigation.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.

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/tabbed_navigation.rb', line 12

def menu
  @menu
end

Instance Method Details

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

Build a new tabbed navigation component.

Parameters:

  • menu (ActiveAdmin::Menu)

    the Menu to render

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

    the options as passed to the underlying ul element.



19
20
21
22
23
# File 'lib/active_admin/views/tabbed_navigation.rb', line 19

def build(menu, options = {})
  @menu = menu
  super(default_options.merge(options))
  build_menu
end

The top-level menu items that should be displayed.



26
27
28
# File 'lib/active_admin/views/tabbed_navigation.rb', line 26

def menu_items
  menu.items(self)
end

#tag_nameObject



30
31
32
# File 'lib/active_admin/views/tabbed_navigation.rb', line 30

def tag_name
  'ul'
end