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
Overview
Configuration is used to en/disable and initialize addons.
Constant Summary collapse
- DEFAULT_MODE =
:live
- 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.
-
.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
. -
.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.
27 28 29 |
# File 'lib/rails_connector/configuration.rb', line 27 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.
48 49 50 |
# File 'lib/rails_connector/configuration.rb', line 48 def blob_cache_dir @blob_cache_dir end |
.ca_file ⇒ Object
Gets path of a CA certification file in PEM format.
77 78 79 |
# File 'lib/rails_connector/configuration.rb', line 77 def ca_file @ca_file end |
.content_service ⇒ Object (readonly)
Configuration for Content Read Service API.
52 53 54 |
# File 'lib/rails_connector/configuration.rb', line 52 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
.
35 36 37 |
# File 'lib/rails_connector/configuration.rb', line 35 def mode @mode 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).
43 44 45 |
# File 'lib/rails_connector/configuration.rb', line 43 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.
208 209 210 |
# File 'lib/rails_connector/configuration.rb', line 208 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
67 68 69 70 71 72 73 |
# File 'lib/rails_connector/configuration.rb', line 67 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(
:time_machine
)
151 152 153 154 155 156 157 |
# File 'lib/rails_connector/configuration.rb', line 151 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'
170 171 172 |
# File 'lib/rails_connector/configuration.rb', line 170 def instance_name=(name) RailsConnector::CmsBaseModel.instance_name = name if RailsConnector.platform_fiona? end |