Class: Alchemy::Admin::LocaleSelect
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Alchemy::Admin::LocaleSelect
- Defined in:
- app/components/alchemy/admin/locale_select.rb
Overview
Renders a locale select tag for switching the backend locale.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name = :change_locale) ⇒ LocaleSelect
constructor
A new instance of LocaleSelect.
- #render? ⇒ Boolean
Constructor Details
#initialize(name = :change_locale) ⇒ LocaleSelect
Returns a new instance of LocaleSelect.
7 8 9 |
# File 'app/components/alchemy/admin/locale_select.rb', line 7 def initialize(name = :change_locale) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'app/components/alchemy/admin/locale_select.rb', line 5 def name @name end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/components/alchemy/admin/locale_select.rb', line 11 def call select_tag( name, ( translations_for_select, ::I18n.locale ) ) end |
#render? ⇒ Boolean
21 22 23 |
# File 'app/components/alchemy/admin/locale_select.rb', line 21 def render? available_locales.many? end |