Class: StompBase::Pages::SettingsComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- StompBase::Pages::SettingsComponent
- Defined in:
- app/components/stomp_base/pages/settings_component.rb
Instance Method Summary collapse
- #form_url ⇒ Object
-
#initialize(title: nil, current_locale: nil, current_theme: nil) ⇒ SettingsComponent
constructor
A new instance of SettingsComponent.
- #language_icon_path ⇒ Object
- #language_options ⇒ Object
- #theme_icon_path ⇒ Object
- #theme_options ⇒ Object
Methods inherited from BaseComponent
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_url ⇒ Object
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_path ⇒ Object
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_options ⇒ Object
13 14 15 16 17 18 |
# File 'app/components/stomp_base/pages/settings_component.rb', line 13 def [ [t("stomp_base.settings.languages.japanese"), "ja"], [t("stomp_base.settings.languages.english"), "en"] ] end |
#theme_icon_path ⇒ Object
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_options ⇒ Object
20 21 22 23 24 25 |
# File 'app/components/stomp_base/pages/settings_component.rb', line 20 def [ [t("stomp_base.settings.themes.light"), "light"], [t("stomp_base.settings.themes.dark"), "dark"] ] end |