Class: Plum::Configuration
- Inherits:
-
Object
- Object
- Plum::Configuration
- Defined in:
- lib/plum/configuration.rb
Instance Attribute Summary collapse
-
#authorize_with ⇒ Object
Returns the value of attribute authorize_with.
-
#config_path ⇒ Object
Returns the value of attribute config_path.
-
#content_sources ⇒ Object
readonly
Returns the value of attribute content_sources.
-
#cp_accent_color ⇒ Object
Returns the value of attribute cp_accent_color.
-
#cp_back_label ⇒ Object
Returns the value of attribute cp_back_label.
-
#cp_back_url ⇒ Object
Returns the value of attribute cp_back_url.
-
#cp_logo_path ⇒ Object
Returns the value of attribute cp_logo_path.
-
#cp_name ⇒ Object
Returns the value of attribute cp_name.
-
#cp_sidebar_bg ⇒ Object
Returns the value of attribute cp_sidebar_bg.
-
#cp_sidebar_header_bg ⇒ Object
Returns the value of attribute cp_sidebar_header_bg.
-
#cp_sidebar_muted ⇒ Object
Returns the value of attribute cp_sidebar_muted.
-
#cp_sidebar_text ⇒ Object
Returns the value of attribute cp_sidebar_text.
-
#cp_subtitle ⇒ Object
Returns the value of attribute cp_subtitle.
-
#current_site_resolver ⇒ Object
Returns the value of attribute current_site_resolver.
-
#current_user_resolver ⇒ Object
Returns the value of attribute current_user_resolver.
-
#host_authorization_resolver ⇒ Object
Returns the value of attribute host_authorization_resolver.
-
#mailer_sender ⇒ Object
Returns the value of attribute mailer_sender.
-
#powered_by_name ⇒ Object
Returns the value of attribute powered_by_name.
-
#powered_by_url ⇒ Object
Returns the value of attribute powered_by_url.
-
#static_cache_enabled ⇒ Object
Returns the value of attribute static_cache_enabled.
-
#static_cache_path ⇒ Object
Returns the value of attribute static_cache_path.
- #theme_paths ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register_content_source(handle, source = nil, &block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/plum/configuration.rb', line 14 def initialize @authorize_with = :plum @mailer_sender = "no-reply@example.com" @cp_name = "Plum" @cp_subtitle = "CMS" @cp_logo_path = "plum-mark.svg" @cp_accent_color = "#7c3aed" @cp_sidebar_bg = "#241B27" @cp_sidebar_header_bg = "#1E1621" @cp_sidebar_text = "#D9CBD4" @cp_sidebar_muted = "#A8929F" @cp_back_url = nil @cp_back_label = "← Back" @powered_by_name = "Plum" @powered_by_url = "https://plumcms.com" # Explicit opt-in — see docs/static-caching.md before enabling. Off by # default because it's only correct on a single-server deployment; # silently corrupts pages (stale content served forever from whichever # node didn't get the invalidation) on multi-node platforms like # Heroku/Render with 2+ dynos. @static_cache_enabled = false @static_cache_path = nil # Directory for config-as-code YAML (content types, fieldsets). # nil = default to Rails.root/plum when the tasks are invoked. @config_path = nil @content_sources = ContentSourceRegistry.new @current_site_resolver = ->(_controller) { Plum::Site.first_or_create_standalone! } @current_user_resolver = lambda { |controller| Plum::User.find_by(id: controller.session[:plum_user_id]) if controller.session[:plum_user_id] } @host_authorization_resolver = ->(controller) { Plum.current_user(controller).present? } end |
Instance Attribute Details
#authorize_with ⇒ Object
Returns the value of attribute authorize_with.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def @authorize_with end |
#config_path ⇒ Object
Returns the value of attribute config_path.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def config_path @config_path end |
#content_sources ⇒ Object (readonly)
Returns the value of attribute content_sources.
12 13 14 |
# File 'lib/plum/configuration.rb', line 12 def content_sources @content_sources end |
#cp_accent_color ⇒ Object
Returns the value of attribute cp_accent_color.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def cp_accent_color @cp_accent_color end |
#cp_back_label ⇒ Object
Returns the value of attribute cp_back_label.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def cp_back_label @cp_back_label end |
#cp_back_url ⇒ Object
Returns the value of attribute cp_back_url.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def cp_back_url @cp_back_url end |
#cp_logo_path ⇒ Object
Returns the value of attribute cp_logo_path.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def cp_logo_path @cp_logo_path end |
#cp_name ⇒ Object
Returns the value of attribute cp_name.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def cp_name @cp_name end |
#cp_sidebar_bg ⇒ Object
Returns the value of attribute cp_sidebar_bg.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def @cp_sidebar_bg end |
#cp_sidebar_header_bg ⇒ Object
Returns the value of attribute cp_sidebar_header_bg.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def @cp_sidebar_header_bg end |
#cp_sidebar_muted ⇒ Object
Returns the value of attribute cp_sidebar_muted.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def @cp_sidebar_muted end |
#cp_sidebar_text ⇒ Object
Returns the value of attribute cp_sidebar_text.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def @cp_sidebar_text end |
#cp_subtitle ⇒ Object
Returns the value of attribute cp_subtitle.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def cp_subtitle @cp_subtitle end |
#current_site_resolver ⇒ Object
Returns the value of attribute current_site_resolver.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def current_site_resolver @current_site_resolver end |
#current_user_resolver ⇒ Object
Returns the value of attribute current_user_resolver.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def current_user_resolver @current_user_resolver end |
#host_authorization_resolver ⇒ Object
Returns the value of attribute host_authorization_resolver.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def @host_authorization_resolver end |
#mailer_sender ⇒ Object
Returns the value of attribute mailer_sender.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def mailer_sender @mailer_sender end |
#powered_by_name ⇒ Object
Returns the value of attribute powered_by_name.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def powered_by_name @powered_by_name end |
#powered_by_url ⇒ Object
Returns the value of attribute powered_by_url.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def powered_by_url @powered_by_url end |
#static_cache_enabled ⇒ Object
Returns the value of attribute static_cache_enabled.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def static_cache_enabled @static_cache_enabled end |
#static_cache_path ⇒ Object
Returns the value of attribute static_cache_path.
5 6 7 |
# File 'lib/plum/configuration.rb', line 5 def static_cache_path @static_cache_path end |
#theme_paths ⇒ Object
47 48 49 |
# File 'lib/plum/configuration.rb', line 47 def theme_paths Array(@theme_paths.presence || default_theme_paths).map { |path| Pathname(path) }.uniq(&:to_s) end |
Instance Method Details
#register_content_source(handle, source = nil, &block) ⇒ Object
51 52 53 |
# File 'lib/plum/configuration.rb', line 51 def register_content_source(handle, source = nil, &block) content_sources.register(handle, source, &block) end |