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
@@database_cache_store_max_items =
10000

Class Method Summary collapse

Class Method Details

.add_actions_for(*types, &block) ⇒ Object



92
93
94
95
96
# File 'lib/para/config.rb', line 92

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



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

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



48
49
50
51
# File 'lib/para/config.rb', line 48

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


75
76
77
78
79
80
81
82
# File 'lib/para/config.rb', line 75

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



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

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



84
85
86
# File 'lib/para/config.rb', line 84

def self.routes
  Para::Routes
end