Class: Faalis::Dashboard::Models::Menu

Inherits:
Item
  • Object
show all
Defined in:
lib/faalis/dashboard/models/sidebar.rb

Instance Attribute Summary

Attributes inherited from Item

#icon, #members_only, #model, #title, #url

Instance Method Summary collapse

Methods inherited from Item

#visible?

Constructor Details

#initialize(title, options) ⇒ Menu

Returns a new instance of Menu



48
49
50
51
52
53
54
55
56
# File 'lib/faalis/dashboard/models/sidebar.rb', line 48

def initialize(title, options)
  children = options.delete :children
  if children
    @children = children.map do |child|
      Item.new(child.delete(:title), child)
    end
  end
  super
end

Instance Method Details

#add_child(child) ⇒ Object



43
44
45
46
# File 'lib/faalis/dashboard/models/sidebar.rb', line 43

def add_child(child)
  @children ||= []
  @children << child
end

#childrenObject



39
40
41
# File 'lib/faalis/dashboard/models/sidebar.rb', line 39

def children
  @children || []
end