Fix helper to merge style option correctly

This commit is contained in:
Marko Lovic
2018-08-23 18:28:25 +02:00
committed by Javi Martín
parent 1fb1437886
commit ca5f8719a8
3 changed files with 5 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ module GlobalizeHelper
end
def display_translation?(locale)
same_locale?(neutral_locale(I18n.locale), neutral_locale(locale)) ? "" : "display: none"
same_locale?(neutral_locale(I18n.locale), neutral_locale(locale)) ? "" : "display: none;"
end
def translation_enabled_tag(locale, enabled)
@@ -19,7 +19,7 @@ module GlobalizeHelper
end
def css_to_display_translation?(resource, locale)
enable_locale?(resource, locale) ? "" : "display: none"
enable_locale?(resource, locale) ? "" : "display: none;"
end
def enable_locale?(resource, locale)

View File

@@ -4,6 +4,6 @@ module SiteCustomizationHelper
end
def site_customization_display_translation?(locale)
site_customization_enable_translation?(locale) ? "" : "display: none"
site_customization_enable_translation?(locale) ? "" : "display: none;"
end
end

View File

@@ -15,11 +15,11 @@ module TranslatableFormHelper
def merge_translatable_field_options(options, locale)
options.merge(
class: "#{options[:class]} js-globalize-attribute".strip,
style: display_translation?(locale),
style: "#{options[:style]} #{display_translation?(locale)}".strip,
data: options.fetch(:data, {}).merge(locale: locale),
label_options: {
class: "#{options.dig(:label_options, :class)} js-globalize-attribute".strip,
style: display_translation?(locale),
style: "#{options.dig(:label_options, :style)} #{display_translation?(locale)}".strip,
data: (options.dig(:label_options, :data) || {}) .merge(locale: locale)
}
)