Class: ActiveAdmin::PageDSL
Overview
This is the class where all the register_page blocks are evaluated.
Instance Method Summary collapse
- #belongs_to(target, options = {}) ⇒ Object
-
#content(options = {}, &block) ⇒ Object
Page content.
- #page_action(name, options = {}, &block) ⇒ Object
Methods inherited from DSL
#action_item, #batch_action, #breadcrumb, #config, #controller, #define_controller_method, #include, #initialize, #menu, #navigation_menu, #run_registration_block, #set_title_before_action, #sidebar
Constructor Details
This class inherits a constructor from ActiveAdmin::DSL
Instance Method Details
#belongs_to(target, options = {}) ⇒ Object
31 32 33 |
# File 'lib/active_admin/page_dsl.rb', line 31 def belongs_to(target, = {}) config.belongs_to(target, ) 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
17 18 19 20 21 22 23 |
# File 'lib/active_admin/page_dsl.rb', line 17 def content( = {}, &block) if block_given? config.set_page_presenter :index, ActiveAdmin::PagePresenter.new(, &block) else config. :index, end end |
#page_action(name, options = {}, &block) ⇒ Object
25 26 27 28 29 |
# File 'lib/active_admin/page_dsl.rb', line 25 def page_action(name, = {}, &block) define_controller_method(name, &block) config.add_page_route(name, ) end |