Module: Locomotive::SitesHelper
- Defined in:
- app/helpers/locomotive/sites_helper.rb
Instance Method Summary collapse
- #options_for_site_locales ⇒ Object
- #options_for_site_timezones ⇒ Object
-
#ordered_current_site_locales ⇒ Object
forms.
Instance Method Details
#options_for_site_locales ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/locomotive/sites_helper.rb', line 10 def Rails.cache.fetch(base_cache_key_without_site + ['locales']) do (Locomotive.config.site_locales - [:ca, :"sv-FI"]).map do |locale| text = I18n.t("locomotive.locales.#{locale}", default: locale) nice_display = h("#{flag_tag(locale)} #{text} – #{locale}") [ text, locale, { :"data-display" => nice_display.html_safe } ] end end end |
#options_for_site_timezones ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/helpers/locomotive/sites_helper.rb', line 25 def Rails.cache.fetch([Locomotive::VERSION, 'timezones']) do ActiveSupport::TimeZone.all.map do |tz| [tz.to_s, tz.name] end end end |
#ordered_current_site_locales ⇒ Object
forms
6 7 8 |
# File 'app/helpers/locomotive/sites_helper.rb', line 6 def ordered_current_site_locales current_site.locales + (Locomotive.config.site_locales - current_site.locales) end |