Class: AdminIt::Section

Inherits:
Object
  • Object
show all
Extended by:
ExtendIt::Base
Includes:
Iconed, Renderable, ExtendIt::Dsl
Defined in:
lib/admin_it/context/single_context.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, context, display_name: nil) ⇒ Section

Returns a new instance of Section.



37
38
39
40
41
42
43
44
45
46
# File 'lib/admin_it/context/single_context.rb', line 37

def initialize(name, context, display_name: nil)
  @name = name
  @display_name = display_name || name
  @context = context
  @fields = context.fields.map(&:field_name)
  context.sections.each do |section|
    next if section.name == name
    @fields -= section.fields
  end
end

Instance Attribute Details

#display_nameObject (readonly)

Returns the value of attribute display_name.



12
13
14
# File 'lib/admin_it/context/single_context.rb', line 12

def display_name
  @display_name
end

#fieldsObject (readonly)

Returns the value of attribute fields.



12
13
14
# File 'lib/admin_it/context/single_context.rb', line 12

def fields
  @fields
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/admin_it/context/single_context.rb', line 12

def name
  @name
end

Class Method Details

.attr_checker(*names) ⇒ Object Originally defined in module ExtendIt::Base

.call_inherited(method_name, *args, base_first: false, &block) ⇒ Object Originally defined in module ExtendIt::Base

.class_attr_reader(*attrs) ⇒ Object Originally defined in module ExtendIt::Base

.inherited_class_reader(*names) ⇒ Object Originally defined in module ExtendIt::Base

.metaclass(&block) ⇒ Object Originally defined in module ExtendIt::Base

Instance Method Details

#dsl_eval(&block) ⇒ Object Originally defined in module ExtendIt::Dsl

#iconObject Originally defined in module Iconed

#icon=(value) ⇒ Object Originally defined in module Iconed

#icon?Boolean Originally defined in module Iconed

Returns:

  • (Boolean)

#render(entity, instance = nil, &block) ⇒ Object Originally defined in module Renderable

#renderable?Boolean Originally defined in module Renderable

Returns:

  • (Boolean)

#visible?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/admin_it/context/single_context.rb', line 33

def visible?
  @visible.nil? ? @visible = true : @visible == true
end