Class: Aerogel::Admin::Menu::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/aerogel/admin/menu.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, opts = {}) ⇒ Item

Returns a new instance of Item.



18
19
20
21
22
23
# File 'lib/aerogel/admin/menu.rb', line 18

def initialize( url, opts = {} )
  self.url = url
  self.icon = opts[:icon]
  self.label = opts[:label] || url
  self.priority = opts[:priority] || 50
end

Instance Attribute Details

#iconObject

Returns the value of attribute icon.



17
18
19
# File 'lib/aerogel/admin/menu.rb', line 17

def icon
  @icon
end

#labelObject

Returns the value of attribute label.



17
18
19
# File 'lib/aerogel/admin/menu.rb', line 17

def label
  @label
end

#priorityObject

Returns the value of attribute priority.



17
18
19
# File 'lib/aerogel/admin/menu.rb', line 17

def priority
  @priority
end

#urlObject

Returns the value of attribute url.



17
18
19
# File 'lib/aerogel/admin/menu.rb', line 17

def url
  @url
end

Class Method Details

.create(url, opts = {}) ⇒ Object



25
26
27
# File 'lib/aerogel/admin/menu.rb', line 25

def self.create( url, opts = {} )
  Menu.instance.items << self.new( url, opts )
end

Instance Method Details

#human_labelObject



29
30
31
32
33
34
35
# File 'lib/aerogel/admin/menu.rb', line 29

def human_label
  if label.is_a? Symbol
    I18n.t label
  else
    label.humanize
  end
end