Class: ActiveAdmin::MenuItem
- Inherits:
 - 
      Object
      
        
- Object
 - ActiveAdmin::MenuItem
 
 
- Includes:
 - ActiveAdmin::Menu::MenuNode
 
- Defined in:
 - lib/active_admin/menu_item.rb
 
Instance Attribute Summary collapse
- 
  
    
      #html_options  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute html_options.
 - 
  
    
      #label  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute label.
 - 
  
    
      #parent  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute parent.
 - 
  
    
      #priority  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute priority.
 - 
  
    
      #should_display  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Don’t display if the :if option passed says so.
 - 
  
    
      #url  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute url.
 
Attributes included from ActiveAdmin::Menu::MenuNode
Instance Method Summary collapse
- #id ⇒ Object
 - 
  
    
      #initialize(options = {}) {|_self| ... } ⇒ MenuItem 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Builds a new menu item.
 
Methods included from ActiveAdmin::Menu::MenuNode
#[], #[]=, #add, #current?, #include?, #items
Constructor Details
#initialize(options = {}) {|_self| ... } ⇒ MenuItem
Builds a new menu item
NOTE: for :label, :url, and :if These options are evaluated in the view context at render time. Symbols are called as methods on ‘self`, and Procs are exec’d within ‘self`. Here are some examples of what you can do:
 if:  :admin?
 url: :new_book_path
 url: :awesome_helper_you_defined
 label: ->{ User.some_method }
 label: ->{ I18n.t 'menus.user' }
  
      47 48 49 50 51 52 53 54 55 56 57 58  | 
    
      # File 'lib/active_admin/menu_item.rb', line 47 def initialize( = {}) super() # MenuNode @label = [:label] @dirty_id = [:id] || [:label] @url = [:url] || "#" @priority = [:priority] || 10 @html_options = [:html_options] || {} @should_display = [:if] || proc { true } @parent = [:parent] yield(self) if block_given? # Builder style syntax end  | 
  
Instance Attribute Details
#html_options ⇒ Object (readonly)
Returns the value of attribute html_options.
      6 7 8  | 
    
      # File 'lib/active_admin/menu_item.rb', line 6 def @html_options end  | 
  
#label ⇒ Object (readonly)
Returns the value of attribute label.
      64 65 66  | 
    
      # File 'lib/active_admin/menu_item.rb', line 64 def label @label end  | 
  
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
      6 7 8  | 
    
      # File 'lib/active_admin/menu_item.rb', line 6 def parent @parent end  | 
  
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
      6 7 8  | 
    
      # File 'lib/active_admin/menu_item.rb', line 6 def priority @priority end  | 
  
#should_display ⇒ Object (readonly)
Don’t display if the :if option passed says so
      68 69 70  | 
    
      # File 'lib/active_admin/menu_item.rb', line 68 def should_display @should_display end  | 
  
#url ⇒ Object (readonly)
Returns the value of attribute url.
      65 66 67  | 
    
      # File 'lib/active_admin/menu_item.rb', line 65 def url @url end  | 
  
Instance Method Details
#id ⇒ Object
      60 61 62  | 
    
      # File 'lib/active_admin/menu_item.rb', line 60 def id @id ||= normalize_id @dirty_id end  |