Module: Locomotive::SitesHelper

Defined in:
app/helpers/locomotive/sites_helper.rb

Instance Method Summary collapse

Instance Method Details

#options_for_site_localesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/locomotive/sites_helper.rb', line 10

def options_for_site_locales
  Locomotive.config.site_locales.map do |locale|
    text          = I18n.t("locomotive.locales.#{locale}")
    flag_url      = path_to_image "locomotive/icons/flags/#{locale}.png"
    nice_display  = h("<img class='flag' src='#{flag_url}' width='24px' />" + text)

    [
      text,
      locale,
      { :data-display" => nice_display }
    ]
  end
end

#options_for_site_timezonesObject



24
25
26
27
28
# File 'app/helpers/locomotive/sites_helper.rb', line 24

def options_for_site_timezones
  ActiveSupport::TimeZone.all.map do |tz|
    [tz, tz.name]
  end
end

#ordered_current_site_localesObject

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