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 =
%i[admin_name admin_title name title]
@@enable_app_breadcrumbs =
true
@@para_components_directory =
'components'
@@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 =
10_000

Class Method Summary collapse

Class Method Details

.add_actions_for(*types, &block) ⇒ Object



99
100
101
102
103
# File 'lib/para/config.rb', line 99

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



63
64
65
# File 'lib/para/config.rb', line 63

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



55
56
57
58
# File 'lib/para/config.rb', line 55

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


82
83
84
85
86
87
88
89
# File 'lib/para/config.rb', line 82

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



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

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

.plugins=(array) ⇒ Object



31
32
33
34
# File 'lib/para/config.rb', line 31

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

.routesObject



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

def self.routes
  Para::Routes
end