Class: Plum::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/plum/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/plum/configuration.rb', line 13

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"
  @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_withObject

Returns the value of attribute authorize_with.



5
6
7
# File 'lib/plum/configuration.rb', line 5

def authorize_with
  @authorize_with
end

#content_sourcesObject (readonly)

Returns the value of attribute content_sources.



11
12
13
# File 'lib/plum/configuration.rb', line 11

def content_sources
  @content_sources
end

#cp_accent_colorObject

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_labelObject

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_urlObject

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_pathObject

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_nameObject

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_bgObject

Returns the value of attribute cp_sidebar_bg.



5
6
7
# File 'lib/plum/configuration.rb', line 5

def cp_sidebar_bg
  @cp_sidebar_bg
end

#cp_sidebar_header_bgObject

Returns the value of attribute cp_sidebar_header_bg.



5
6
7
# File 'lib/plum/configuration.rb', line 5

def cp_sidebar_header_bg
  @cp_sidebar_header_bg
end

#cp_sidebar_mutedObject

Returns the value of attribute cp_sidebar_muted.



5
6
7
# File 'lib/plum/configuration.rb', line 5

def cp_sidebar_muted
  @cp_sidebar_muted
end

#cp_sidebar_textObject

Returns the value of attribute cp_sidebar_text.



5
6
7
# File 'lib/plum/configuration.rb', line 5

def cp_sidebar_text
  @cp_sidebar_text
end

#cp_subtitleObject

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_resolverObject

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_resolverObject

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_resolverObject

Returns the value of attribute host_authorization_resolver.



5
6
7
# File 'lib/plum/configuration.rb', line 5

def host_authorization_resolver
  @host_authorization_resolver
end

#mailer_senderObject

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_nameObject

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_urlObject

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

#theme_pathsObject



36
37
38
# File 'lib/plum/configuration.rb', line 36

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



40
41
42
# File 'lib/plum/configuration.rb', line 40

def register_content_source(handle, source = nil, &block)
  content_sources.register(handle, source, &block)
end