Class: Postnhost::Onboarding::Steps::ChooseLanguages
- Inherits:
-
Base
- Object
- BaseService
- Base
- Postnhost::Onboarding::Steps::ChooseLanguages
- Defined in:
- app/services/postnhost/onboarding/steps/choose_languages.rb
Constant Summary
Constants inherited from Base
Base::LANGUAGE_OPTIONS, Base::SITE_COPY_KEYS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Postnhost::Onboarding::Steps::Base
Instance Method Details
#call ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/postnhost/onboarding/steps/choose_languages.rb', line 5 def call return restart_at_admin_account unless pending_user = LANGUAGE_OPTIONS.index_by { |option| option[:html_lang] } locales = selected_locales default_locale = selected_default_locale payload = language_selection_payload(locales:, default_locale:) return render_show(**payload, alert: "Select at least one language.") if locales.empty? return render_show(**payload, alert: "Choose valid languages.") if locales.any? { |locale| !.key?(locale) } return render_show(**payload, alert: "Default language must be one of the selected languages.") unless locales.include?(default_locale) replace_languages!(locales:, default_locale:, options_by_locale:) advance_session(locales:, default_locale:) redirect_onboarding end |