Class: ActiveAdmin::PageDSL

Inherits:
DSL
  • Object
show all
Defined in:
lib/active_admin/page_dsl.rb

Overview

This is the class where all the register_page blocks are evaluated.

Instance Method Summary collapse

Methods inherited from DSL

#action_item, #batch_action, #breadcrumb, #config, #controller, #include, #initialize, #menu, #navigation_menu, #run_registration_block, #sidebar

Constructor Details

This class inherits a constructor from ActiveAdmin::DSL

Instance Method Details

#belongs_to(target, options = {}) ⇒ Object



29
30
31
# File 'lib/active_admin/page_dsl.rb', line 29

def belongs_to(target, options = {})
  config.belongs_to(target, options)
end

#content(options = {}, &block) ⇒ Object

Page content.

The block should define the view using Arbre.

Example:

ActiveAdmin.register "My Page" do
  content do
    para "Sweet!"
  end
end


18
19
20
# File 'lib/active_admin/page_dsl.rb', line 18

def content(options = {}, &block)
  config.set_page_presenter :index, ActiveAdmin::PagePresenter.new(options, &block)
end

#page_action(name, options = {}, &block) ⇒ Object



22
23
24
25
26
27
# File 'lib/active_admin/page_dsl.rb', line 22

def page_action(name, options = {}, &block)
  config.page_actions << ControllerAction.new(name, options)
  controller do
    define_method(name, &block || Proc.new {})
  end
end