Class: MissionControl::Jobs::Theme::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/mission_control/jobs/theme/configuration.rb

Overview

Hold user-configurable options for the theme middleware.

See Also:

Constant Summary collapse

THEMES =

Available theme families. Each entry must have matching {name}_light.min.css and {name}_dark.min.css files under assets/mission_control/css/.

%i[malachite].freeze
COLOR_SCHEMES =

Available color scheme preferences.

%i[light dark].freeze
"mc_jobs_color_scheme"
DEFAULT_THEME =

Returns the default theme family.

Returns:

  • (Symbol)

    the default theme family

:malachite
DEFAULT_COLOR_SCHEME =

Returns the default color scheme.

Returns:

  • (Symbol)

    the default color scheme

:auto

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



48
49
50
51
52
53
54
# File 'lib/mission_control/jobs/theme/configuration.rb', line 48

def initialize
  @color_scheme = DEFAULT_COLOR_SCHEME
  @color_scheme_switcher = true
  @mount_path = nil
  @syntax_highlighting = true
  @theme = DEFAULT_THEME
end

Instance Attribute Details

#color_schemeSymbol

Returns the active color scheme (:auto, :light, or :dark). :auto injects both light and dark stylesheets with prefers-color-scheme media queries so the browser picks the one matching the OS preference.

Returns:

  • (Symbol)

    the active color scheme (:auto, :light, or :dark). :auto injects both light and dark stylesheets with prefers-color-scheme media queries so the browser picks the one matching the OS preference.



31
32
33
# File 'lib/mission_control/jobs/theme/configuration.rb', line 31

def color_scheme
  @color_scheme
end

#color_scheme_switcherBoolean

Returns whether to inject the color scheme switcher UI control (default: true).

Returns:

  • (Boolean)

    whether to inject the color scheme switcher UI control (default: true)



35
36
37
# File 'lib/mission_control/jobs/theme/configuration.rb', line 35

def color_scheme_switcher
  @color_scheme_switcher
end

#mount_pathString?

Returns override the auto-discovered engine mount path (e.g. “/admin/jobs”). When nil, RouteDiscovery detects it at boot.

Returns:

  • (String, nil)

    override the auto-discovered engine mount path (e.g. “/admin/jobs”). When nil, RouteDiscovery detects it at boot.



39
40
41
# File 'lib/mission_control/jobs/theme/configuration.rb', line 39

def mount_path
  @mount_path
end

#syntax_highlightingBoolean

Returns whether to inject Prism.js syntax highlighting for JSON payloads (default: true).

Returns:

  • (Boolean)

    whether to inject Prism.js syntax highlighting for JSON payloads (default: true)



43
44
45
# File 'lib/mission_control/jobs/theme/configuration.rb', line 43

def syntax_highlighting
  @syntax_highlighting
end

#themeSymbol

Returns the active theme family (must be listed in THEMES).

Returns:

  • (Symbol)

    the active theme family (must be listed in THEMES)



46
47
48
# File 'lib/mission_control/jobs/theme/configuration.rb', line 46

def theme
  @theme
end