Files
nairobi/app/helpers/globalize_helper.rb
iagirre 285e02ce96 Highlight current locale when changing locale from select
When the locale changes the corresponding tab is
highlighted automatically.
When a language is added to the milestone, the tab
is highlighted automatically.
2018-05-09 16:07:21 +02:00

42 lines
895 B
Ruby

module GlobalizeHelper
def globalize_locale
params[:globalize_locale] || I18n.locale
end
def options_for_locale_select
options_for_select(locale_options, nil)
end
def locale_options
I18n.available_locales.map do |locale|
[name_for_locale(locale), locale]
end
end
def display_translation?(locale)
I18n.locale == locale ? "" : "display: none"
end
def css_to_display_translation?(resource, locale)
resource.translated_locales.include?(locale) || locale == I18n.locale ? "" : "display: none"
end
def disable_translation?(locale)
locale == "en" ? "" : "disabled"
end
def css_for_globalize_locale(locale)
globalize_locale == locale ? "highlight" : ""
end
def highlight_current?(locale)
I18n.locale == locale ? 'highlight' : ''
end
def show_delete?(locale)
I18n.locale == locale ? '' : 'display: none'
end
end