Module: Qadmin::Controller::Macros

Defined in:
lib/qadmin/controller.rb

Instance Method Summary collapse

Instance Method Details

#qadmin(options = {}) {|self.qadmin_configuration| ... } ⇒ Object

Yields:

  • (self.qadmin_configuration)


7
8
9
10
11
12
13
14
15
16
# File 'lib/qadmin/controller.rb', line 7

def qadmin(options = {})
  self.cattr_accessor :qadmin_configuration
  self.qadmin_configuration = Qadmin::Configuration.new({:controller_klass => self}.merge(options))
  self.delegate :model_name, :model_klass, :model_collection_name, :model_instance_name, :model_human_name, :to => lambda { self.class.qadmin_configuration }
  yield(self.qadmin_configuration) if block_given?
  include Qadmin::Templates
  include Qadmin::Overlay
  self.append_view_path(File.join(File.dirname(__FILE__), 'views'))
  define_admin_actions(qadmin_configuration.available_actions, options)
end