Module: Para::Config

Defined in:
lib/para/config.rb

Constant Summary collapse

@@authenticate_admin_method =
:authenticate_admin_user!
@@current_admin_method =
:current_admin_user
@@pagination_theme =
'twitter-bootstrap-3'
@@admin_title =
nil
@@default_tree_max_depth =
3
@@resource_name_methods =
[:admin_name, :admin_title, :name, :title]
@@enable_app_breadcrumbs =
true
@@plugins =
Para::Plugins::Set.new
@@ability_class_name =
'Para::Ability'
@@page_actions =
{}
@@dark_theme =
false
@@uncollapse_inset_nested_fields =
true
@@database_cache_store_max_items =
10000

Class Method Summary collapse

Class Method Details

.add_actions_for(*types, &block) ⇒ Object



95
96
97
98
99
# File 'lib/para/config.rb', line 95

def self.add_actions_for(*types, &block)
  types.each do |type|
    page_actions_for(type) << block
  end
end

.jobs_storeObject

Default to use Para::Cache::DatabaseStore, allowing cross process and app instances job status sharing



59
60
61
# File 'lib/para/config.rb', line 59

def self.jobs_store
  @@jobs_store ||= Para::Cache::DatabaseStore.new
end

.jobs_store=(store) ⇒ Object

Allows changing default cache store used by Para to store jobs through the ActiveJob::Status gem



51
52
53
54
# File 'lib/para/config.rb', line 51

def self.jobs_store=(store)
  @@jobs_store = store
  ActiveJob::Status.store = store
end

.method_missing(method_name, *args, &block) ⇒ Object

Allows accessing plugins root module to configure them through a method from the Para::Config class.

Example :

Para.config do |config|
  config.my_plugin.my_var = 'foo'
end


78
79
80
81
82
83
84
85
# File 'lib/para/config.rb', line 78

def self.method_missing(method_name, *args, &block)
  if plugins.include?(method_name)
    plugin = Para::Plugins.module_name_for(method_name).constantize
    block ? block.call(plugin) : plugin
  else
    super
  end
end

.page_actions_for(type) ⇒ Object



91
92
93
# File 'lib/para/config.rb', line 91

def self.page_actions_for(type)
  page_actions[type] ||= []
end

.plugins=(array) ⇒ Object



27
28
29
30
# File 'lib/para/config.rb', line 27

def self.plugins=(array)
  # Add each item in array to the existing plugins set
  array.each(&plugins.method(:<<))
end

.routesObject



87
88
89
# File 'lib/para/config.rb', line 87

def self.routes
  Para::Routes
end