Files
grecia/app/helpers/site_customization_helper.rb
Javi Martín 00983200d4 Update information texts translatable fields
This part used the code we deleted in order to make it easier to
refactor the rest of the translatable models. Now we add the code back.
2018-10-22 16:36:12 +02:00

23 lines
623 B
Ruby

module SiteCustomizationHelper
def site_customization_enable_translation?(locale)
I18nContentTranslation.existing_languages.include?(locale) || locale == I18n.locale
end
def site_customization_display_translation_style(locale)
site_customization_enable_translation?(locale) ? "" : "display: none;"
end
def translation_for_locale(content, locale)
i18n_content = I18nContent.where(key: content.key).first
if i18n_content.present?
I18nContentTranslation.where(
i18n_content_id: i18n_content.id,
locale: locale
).first.try(:value)
else
false
end
end
end