Class: Qadmin::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/qadmin/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Configuration

Returns a new instance of Configuration.



17
18
19
20
21
22
23
24
25
26
# File 'lib/qadmin/configuration.rb', line 17

def initialize(options = {})
  extract_model_from_options(options)
  self.available_actions = Qadmin::OptionSet.new([:index, :show, :new, :create, :edit, :update, :destroy], options[:available_actions] || {})
  self.display_columns   = Qadmin::OptionSet.new(model_column_names, options[:display_columns] || {})
  self.multipart_forms   = options[:multipart_forms] || false
  self.default_scope     = options[:default_scope]   || false
  self.ports             = options[:ports]           || false
  self.controls          = options[:controls]        || []
  self.column_headers    = HashWithIndifferentAccess.new(options[:column_headers] || {})
end

Instance Attribute Details

#available_actionsObject

Returns the value of attribute available_actions.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def available_actions
  @available_actions
end

#column_headersObject

Returns the value of attribute column_headers.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def column_headers
  @column_headers
end

#controller_klassObject

Returns the value of attribute controller_klass.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def controller_klass
  @controller_klass
end

#controlsObject

Returns the value of attribute controls.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def controls
  @controls
end

#default_scopeObject

Returns the value of attribute default_scope.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def default_scope
  @default_scope
end

#display_columnsObject

Returns the value of attribute display_columns.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def display_columns
  @display_columns
end

#model_collection_nameObject

Returns the value of attribute model_collection_name.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def model_collection_name
  @model_collection_name
end

#model_human_nameObject

Returns the value of attribute model_human_name.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def model_human_name
  @model_human_name
end

#model_instance_nameObject

Returns the value of attribute model_instance_name.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def model_instance_name
  @model_instance_name
end

#model_nameObject

Returns the value of attribute model_name.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def model_name
  @model_name
end

#multipart_formsObject

Returns the value of attribute multipart_forms.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def multipart_forms
  @multipart_forms
end

#portsObject

Returns the value of attribute ports.



4
5
6
# File 'lib/qadmin/configuration.rb', line 4

def ports
  @ports
end

Instance Method Details

#model_klassObject



28
29
30
# File 'lib/qadmin/configuration.rb', line 28

def model_klass
  self.model_name.constantize
end