Class: StompBase::Pages::SettingsComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/stomp_base/pages/settings_component.rb

Instance Method Summary collapse

Methods inherited from BaseComponent

#call, #render?

Constructor Details

#initialize(title: nil, current_locale: nil, current_theme: nil) ⇒ SettingsComponent

Returns a new instance of SettingsComponent.



6
7
8
9
10
11
# File 'app/components/stomp_base/pages/settings_component.rb', line 6

def initialize(title: nil, current_locale: nil, current_theme: nil)
  super()
  @title = title || t("stomp_base.settings.title")
  @current_locale = current_locale || I18n.default_locale
  @current_theme = current_theme || "light"
end

Instance Method Details

#form_urlObject



36
37
38
# File 'app/components/stomp_base/pages/settings_component.rb', line 36

def form_url
  StompBase::Engine.routes.url_helpers.settings_path
end

#language_icon_pathObject



27
28
29
30
# File 'app/components/stomp_base/pages/settings_component.rb', line 27

def language_icon_path
  "M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 " \
    "10.77 8.07 15.61 3 18.129"
end

#language_optionsObject



13
14
15
16
17
18
# File 'app/components/stomp_base/pages/settings_component.rb', line 13

def language_options
  [
    [t("stomp_base.settings.languages.japanese"), "ja"],
    [t("stomp_base.settings.languages.english"), "en"]
  ]
end

#theme_icon_pathObject



32
33
34
# File 'app/components/stomp_base/pages/settings_component.rb', line 32

def theme_icon_path
  "M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
end

#theme_optionsObject



20
21
22
23
24
25
# File 'app/components/stomp_base/pages/settings_component.rb', line 20

def theme_options
  [
    [t("stomp_base.settings.themes.light"), "light"],
    [t("stomp_base.settings.themes.dark"), "dark"]
  ]
end