From a6e8fecc16ead4798fe439389ea803d6ec11cdd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= Date: Fri, 31 May 2019 18:18:20 +0200 Subject: [PATCH] Highlight translation interface and translatable form fields Only when translations interface is enabled. Co-Authored-By: alessandro --- app/assets/stylesheets/layout.scss | 13 +++++++++++++ app/helpers/translatable_form_helper.rb | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index b7d5a9647..f29c0653b 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1080,6 +1080,19 @@ form { } } +.translatable-fields { + + &.highlight { + display: inline-block; + padding-top: $line-height; + width: 100%; + } +} + +.translation-locale { + padding-top: $line-height; +} + // 07. Callout // ----------- diff --git a/app/helpers/translatable_form_helper.rb b/app/helpers/translatable_form_helper.rb index 934ab19b0..b4c80757f 100644 --- a/app/helpers/translatable_form_helper.rb +++ b/app/helpers/translatable_form_helper.rb @@ -14,6 +14,10 @@ module TranslatableFormHelper (controller.class.parents & [Admin, Management, Valuation]).any? end + def highlight_translation_html_class + "highlight" if translations_interface_enabled? + end + class TranslatableFormBuilder < FoundationRailsHelper::FormBuilder attr_accessor :translations @@ -66,9 +70,13 @@ module TranslatableFormHelper end end + def highlight_translation_html_class + @template.highlight_translation_html_class + end + def translations_options(resource, locale) { - class: "translatable-fields js-globalize-attribute", + class: "translatable-fields js-globalize-attribute #{highlight_translation_html_class}", style: @template.display_translation_style(resource.globalized_model, locale), data: { locale: locale } }