Sha256: 5146e093ce36af66b2f8f73638213ba49b39d19838b0f100588b8b969ca0f6ef

Contents?: true

Size: 912 Bytes

Versions: 10

Compression:

Stored size: 912 Bytes

Contents

module Locomotive
  module SitesHelper

    # forms

    def ordered_current_site_locales
      current_site.locales + (Locomotive.config.site_locales - current_site.locales)
    end

    def options_for_site_locales
      Rails.cache.fetch('views/helpers/site_locales') do
        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
    end

    def options_for_site_timezones
      Rails.cache.fetch('views/helpers/timezones') do
        ActiveSupport::TimeZone.all.map do |tz|
          [tz.to_s, tz.name]
        end
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
locomotivecms-3.0.1 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0.rc7 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0.rc6 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0.rc5 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0.rc4 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0.rc3 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0.rc2 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0.rc1 app/helpers/locomotive/sites_helper.rb
locomotivecms-3.0.0.pre.beta.1 app/helpers/locomotive/sites_helper.rb