Class: Admin::Base::Resource::ShowConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/admin/base/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ ShowConfig

Returns a new instance of ShowConfig.



460
461
462
463
# File 'lib/admin/base/resource.rb', line 460

def initialize
  @sidebar_sections = []
  @main_sections = []
end

Instance Attribute Details

#main_sections ⇒ Object (readonly)

Returns the value of attribute main_sections.



458
459
460
# File 'lib/admin/base/resource.rb', line 458

def main_sections
  @main_sections
end

Returns the value of attribute sidebar_sections.



458
459
460
# File 'lib/admin/base/resource.rb', line 458

def sidebar_sections
  @sidebar_sections
end

Instance Method Details

#main(&block) ⇒ Object



475
476
477
478
479
# File 'lib/admin/base/resource.rb', line 475

def main(&block)
  @current_target = :main
  instance_eval(&block) if block_given?
  @current_target = nil
end

#panel(name, **options) ⇒ Object



481
482
483
484
485
486
487
488
489
490
# File 'lib/admin/base/resource.rb', line 481

def panel(name, **options)
  section_def = build_section(name, options)

  case @current_target
  when :sidebar
    @sidebar_sections << section_def
  else
    @main_sections << section_def
  end
end

#section(name, **options) ⇒ Object



465
466
467
# File 'lib/admin/base/resource.rb', line 465

def section(name, **options)
  @main_sections << build_section(name, options)
end

#sections_list ⇒ Object



492
493
494
# File 'lib/admin/base/resource.rb', line 492

def sections_list
  @main_sections
end


469
470
471
472
473
# File 'lib/admin/base/resource.rb', line 469

def sidebar(&block)
  @current_target = :sidebar
  instance_eval(&block) if block_given?
  @current_target = nil
end