Extract translation helper from translatable form views

So that individual form partials don't depend on the implementation
of how translations are deleted.
This commit is contained in:
Marko Lovic
2018-08-03 15:52:25 +02:00
committed by Javi Martín
parent 3aa53449c8
commit cb716e07d7
5 changed files with 21 additions and 6 deletions

View File

@@ -1,5 +1,9 @@
module SiteCustomizationHelper
def site_customization_enable_translation?(locale)
I18nContentTranslation.existing_languages.include?(neutral_locale(locale)) || locale == I18n.locale
end
def site_customization_display_translation?(locale)
I18nContentTranslation.existing_languages.include?(neutral_locale(locale)) || locale == I18n.locale ? "" : "display: none"
site_customization_enable_translation?(locale) ? "" : "display: none"
end
end