Class: ActiveAdmin::Dashboards::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/active_admin/dashboards/section.rb

Constant Summary collapse

DEFAULT_PRIORITY =
10

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, name, options = {}, &block) ⇒ Section

Returns a new instance of Section.



10
11
12
13
14
15
# File 'lib/active_admin/dashboards/section.rb', line 10

def initialize(namespace, name, options = {}, &block)
  @namespace = namespace
  @name = name
  @options = options
  @block = block
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



7
8
9
# File 'lib/active_admin/dashboards/section.rb', line 7

def block
  @block
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/active_admin/dashboards/section.rb', line 7

def name
  @name
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



8
9
10
# File 'lib/active_admin/dashboards/section.rb', line 8

def namespace
  @namespace
end

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/active_admin/dashboards/section.rb', line 8

def options
  @options
end

Instance Method Details

#<=>(other) ⇒ Object

Sort by priority then by name



26
27
28
29
30
# File 'lib/active_admin/dashboards/section.rb', line 26

def <=>(other)
  result = priority <=> other.priority
  result = name.to_s <=> other.name.to_s if result == 0
  result
end

#iconObject



21
22
23
# File 'lib/active_admin/dashboards/section.rb', line 21

def icon
  @options[:icon]
end

#priorityObject



17
18
19
# File 'lib/active_admin/dashboards/section.rb', line 17

def priority
  @options[:priority] || DEFAULT_PRIORITY
end