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
-
#auto_submit ⇒ Object
readonly
Returns the value of attribute auto_submit.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name = :admin_locale, auto_submit: true) ⇒ LocaleSelect
constructor
A new instance of LocaleSelect.
- #render? ⇒ Boolean
Constructor Details
#initialize(name = :admin_locale, auto_submit: true) ⇒ LocaleSelect
Returns a new instance of LocaleSelect.
7 8 9 10 |
# File 'app/components/alchemy/admin/locale_select.rb', line 7 def initialize(name = :admin_locale, auto_submit: true) @name = name @auto_submit = auto_submit end |
Instance Attribute Details
#auto_submit ⇒ Object (readonly)
Returns the value of attribute auto_submit.
5 6 7 |
# File 'app/components/alchemy/admin/locale_select.rb', line 5 def auto_submit @auto_submit end |
#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
12 13 14 15 16 17 18 19 20 |
# File 'app/components/alchemy/admin/locale_select.rb', line 12 def call form_tag(helpers.url_for, method: :get) do if auto_submit content_tag("alchemy-auto-submit", locale_select) else locale_select end end end |
#render? ⇒ Boolean
22 23 24 |
# File 'app/components/alchemy/admin/locale_select.rb', line 22 def render? available_locales.many? end |