Sha256: dd7552328b6ba8d6234a2c138402d0a9a104d5a78ec97fe8f7d16a14bf5c9f40

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 Bytes

Contents

module ActiveAdmin
  # This is the class where all the register_page blocks are evaluated.
  class PageDSL < DSL

    # Page content.
    #
    # The block should define the view using Arbre.
    #
    # Example:
    #
    #   ActiveAdmin.register "My Page" do
    #     content do
    #       para "Sweet!"
    #     end
    #   end
    #
    def content(options = {}, &block)
      if block_given?
        config.set_page_presenter :index, ActiveAdmin::PagePresenter.new(options, &block)
      else
        config.set_page_options :index, options
      end
    end

    def page_action(name, options = {}, &block)
      define_controller_method(name, &block)

      config.add_page_route(name, options)
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin-rails-1.7.1 lib/active_admin/page_dsl.rb
activeadmin-rails-1.7.0 lib/active_admin/page_dsl.rb