Class: RailsConnector::Configuration
- Inherits:
-
Object
- Object
- RailsConnector::Configuration
- Defined in:
- lib/rails_connector/configuration.rb,
lib/rails_connector/configuration/rss.rb,
lib/rails_connector/configuration/google_analytics.rb
Defined Under Namespace
Modules: GoogleAnalytics, Rss
Constant Summary collapse
- DEFAULT_MODE =
:live
- DEFAULT_STORE_USER_ATTRS_IN_SESSION =
Default fields which the DefaultUserController will store in the session.
[:login, :first_name, :last_name, :email, :id]
- DEFAULT_CA_FILE =
Default path of a CA certification file in PEM format.
File.('../../../config/ca-bundle.crt', __FILE__)
Class Attribute Summary collapse
-
.auto_liquid_editmarkers ⇒ Object
Automatically generate editmarkers when rendering liquid templates in editor mode.
-
.blob_cache_dir ⇒ Object
define a non-default blob cache dir.
-
.ca_file ⇒ Object
Gets path of a CA certification file in PEM format.
-
.cache_editable_workspaces ⇒ Object
Cache also editable workspaces.
-
.content_service ⇒ Object
readonly
Configuration for Content Read Service API.
-
.mode ⇒ Object
there are three available modes for the rails connector:
live
(show released contents only),preview
(show edited contents)editor
(show edited contents and editor interface (e.g. edit markers)) Default mode islive
. -
.search_options ⇒ Object
default options for SearchRequest.
-
.store_user_attrs_in_session ⇒ Object
Returns fields which the DefaultUserController stores in the session.
-
.use_recaptcha_on_user_registration ⇒ Object
Include ReCaptcha tags in user registration form and validate the captcha when creating a new user registration (default: true).
Class Method Summary collapse
-
.choose_homepage(&block) ⇒ Object
Configure a callback to be invoked when the rails connector delivers the homepage.
-
.editing_auth(&block) ⇒ Object
Configure a callback to be invoked when the rails connector determines, if current visitor is permitted to edit content.
-
.enable(*features) ⇒ Object
Rails Connector Addons can be enabled as follows (in
config/rails_connector.rb
):. -
.instance_name=(name) ⇒ Object
Configures your CMS instance name.
Class Attribute Details
.auto_liquid_editmarkers ⇒ Object
Automatically generate editmarkers when rendering liquid templates in editor mode.
31 32 33 |
# File 'lib/rails_connector/configuration.rb', line 31 def auto_liquid_editmarkers @auto_liquid_editmarkers end |
.blob_cache_dir ⇒ Object
define a non-default blob cache dir. fiona connector only. has no effect when used with the cloud connector.
59 60 61 |
# File 'lib/rails_connector/configuration.rb', line 59 def blob_cache_dir @blob_cache_dir end |
.ca_file ⇒ Object
Gets path of a CA certification file in PEM format.
88 89 90 |
# File 'lib/rails_connector/configuration.rb', line 88 def ca_file @ca_file end |
.cache_editable_workspaces ⇒ Object
Cache also editable workspaces. Editable workspaces will be cached until the cache is cleared manually. Should never be used in a production environment.
49 50 51 |
# File 'lib/rails_connector/configuration.rb', line 49 def cache_editable_workspaces @cache_editable_workspaces end |
.content_service ⇒ Object (readonly)
Configuration for Content Read Service API.
63 64 65 |
# File 'lib/rails_connector/configuration.rb', line 63 def content_service @content_service end |
.mode ⇒ Object
there are three available modes for the rails connector: live
(show released contents only), preview
(show edited contents) editor
(show edited contents and editor interface (e.g. edit markers)) Default mode is live
.
39 40 41 |
# File 'lib/rails_connector/configuration.rb', line 39 def mode @mode end |
.search_options ⇒ Object
default options for SearchRequest
102 103 104 |
# File 'lib/rails_connector/configuration.rb', line 102 def @search_options || local_config_file["search"].symbolize_keys end |
.store_user_attrs_in_session ⇒ Object
Returns fields which the DefaultUserController stores in the session. Defaults to DEFAULT_STORE_USER_ATTRS_IN_SESSION.
135 136 137 |
# File 'lib/rails_connector/configuration.rb', line 135 def store_user_attrs_in_session @store_user_attrs_in_session || DEFAULT_STORE_USER_ATTRS_IN_SESSION end |
.use_recaptcha_on_user_registration ⇒ Object
Include ReCaptcha tags in user registration form and validate the captcha when creating a new user registration (default: true).
54 55 56 |
# File 'lib/rails_connector/configuration.rb', line 54 def use_recaptcha_on_user_registration @use_recaptcha_on_user_registration end |
Class Method Details
.choose_homepage(&block) ⇒ Object
Configure a callback to be invoked when the rails connector delivers the homepage. The given callback will receive the rack env and must return an Obj to be used as the homepage. If no callback is configured, Obj.homepage will be used as the default.
240 241 242 |
# File 'lib/rails_connector/configuration.rb', line 240 def choose_homepage(&block) self.choose_homepage_callback = block end |
.editing_auth(&block) ⇒ Object
Configure a callback to be invoked when the rails connector determines, if current visitor is permitted to edit content. Default is false
.
Example Usage:
RailsConnector::Configuation.editing_auth do |env|
request = Rack::Request.new(env)
# return truey if current visitor is permitted to edit content, falsy otherwise
end
78 79 80 81 82 83 84 |
# File 'lib/rails_connector/configuration.rb', line 78 def editing_auth(&block) if block.respond_to?(:arity) && block.arity == 1 self.editing_auth_callback = block else raise ArgumentError, 'editing_auth should have only one attribute!' end end |
.enable(*features) ⇒ Object
Rails Connector Addons can be enabled as follows (in config/rails_connector.rb
):
RailsConnector::Configuration.enable(
:search,
:time_machine,
:crm
)
167 168 169 170 171 172 173 |
# File 'lib/rails_connector/configuration.rb', line 167 def enable(*features) features.each do |f| assert_feature_is_known(f) @features[f.to_sym] = true end initialize_addon_mixins end |
.instance_name=(name) ⇒ Object
Configures your CMS instance name.
Example call as to be used in rails_connector.rb
:
RailsConnector::Configuration.instance_name = 'internet'
186 187 188 |
# File 'lib/rails_connector/configuration.rb', line 186 def instance_name=(name) RailsConnector::CmsBaseModel.instance_name = name end |