Class: Admin::Base::Resource::ShowConfig
- Inherits:
-
Object
- Object
- Admin::Base::Resource::ShowConfig
- Defined in:
- lib/admin/base/resource.rb
Instance Attribute Summary collapse
-
#main_sections ⇒ Object
readonly
Returns the value of attribute main_sections.
-
#sidebar_sections ⇒ Object
readonly
Returns the value of attribute sidebar_sections.
Instance Method Summary collapse
-
#initialize ⇒ ShowConfig
constructor
A new instance of ShowConfig.
- #main(&block) ⇒ Object
- #panel(name, **options) ⇒ Object
- #section(name, **options) ⇒ Object
- #sections_list ⇒ Object
- #sidebar(&block) ⇒ Object
Constructor Details
#initialize ⇒ ShowConfig
Returns a new instance of ShowConfig.
423 424 425 426 |
# File 'lib/admin/base/resource.rb', line 423 def initialize @sidebar_sections = [] @main_sections = [] end |
Instance Attribute Details
#main_sections ⇒ Object (readonly)
Returns the value of attribute main_sections.
421 422 423 |
# File 'lib/admin/base/resource.rb', line 421 def main_sections @main_sections end |
#sidebar_sections ⇒ Object (readonly)
Returns the value of attribute sidebar_sections.
421 422 423 |
# File 'lib/admin/base/resource.rb', line 421 def @sidebar_sections end |
Instance Method Details
#main(&block) ⇒ Object
438 439 440 441 442 |
# File 'lib/admin/base/resource.rb', line 438 def main(&block) @current_target = :main instance_eval(&block) if block_given? @current_target = nil end |
#panel(name, **options) ⇒ Object
444 445 446 447 448 449 450 451 452 453 |
# File 'lib/admin/base/resource.rb', line 444 def panel(name, **) section_def = build_section(name, ) case @current_target when :sidebar @sidebar_sections << section_def else @main_sections << section_def end end |
#section(name, **options) ⇒ Object
428 429 430 |
# File 'lib/admin/base/resource.rb', line 428 def section(name, **) @main_sections << build_section(name, ) end |
#sections_list ⇒ Object
455 456 457 |
# File 'lib/admin/base/resource.rb', line 455 def sections_list @main_sections end |
#sidebar(&block) ⇒ Object
432 433 434 435 436 |
# File 'lib/admin/base/resource.rb', line 432 def (&block) @current_target = :sidebar instance_eval(&block) if block_given? @current_target = nil end |