Class: MissionControl::Jobs::Theme::Configuration
- Inherits:
-
Object
- Object
- MissionControl::Jobs::Theme::Configuration
- Defined in:
- lib/mission_control/jobs/theme/configuration.rb
Overview
Hold user-configurable options for the theme middleware.
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
- COOKIE_NAME =
Cookie name used to persist the user’s color scheme preference.
"mc_jobs_color_scheme"- DEFAULT_THEME =
Returns the default theme family.
:malachite- DEFAULT_COLOR_SCHEME =
Returns the default color scheme.
:auto
Instance Attribute Summary collapse
-
#color_scheme ⇒ Symbol
The active color scheme (
:auto,:light, or:dark). -
#color_scheme_switcher ⇒ Boolean
Whether to inject the color scheme switcher UI control (default:
true). -
#mount_path ⇒ String?
Override the auto-discovered engine mount path (e.g. “/admin/jobs”).
-
#syntax_highlighting ⇒ Boolean
Whether to inject Prism.js syntax highlighting for JSON payloads (default:
true). -
#theme ⇒ Symbol
The active theme family (must be listed in THEMES).
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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_scheme ⇒ Symbol
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.
31 32 33 |
# File 'lib/mission_control/jobs/theme/configuration.rb', line 31 def color_scheme @color_scheme end |
#color_scheme_switcher ⇒ Boolean
Returns 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_path ⇒ String?
Returns 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_highlighting ⇒ Boolean
Returns 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 |
#theme ⇒ Symbol
Returns 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 |