From 9a4a7bd56e208b9a4eba4ffb84d6282513d60652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 3 Apr 2024 22:42:44 +0200 Subject: [PATCH] Remove obsolete parameter rendering globalize locales This parameter isn't used since commit b86c0d3c3, which deleted a file that wasn't used since commit 146c09adb. Further proof that this code wasn't used is the fact that the `enable_translation_style` method, which this code called, was removed in commit 5ada97544. --- .../information_texts/form_field_component.html.erb | 2 +- .../information_texts/form_field_component.rb | 6 +++++- app/helpers/site_customization_helper.rb | 4 ---- app/views/admin/legislation/homepages/_form.html.erb | 5 +---- .../admin/legislation/milestones/_summary_form.html.erb | 5 +---- .../information_texts/_globalize_locales.html.erb | 5 +---- app/views/shared/_globalize_locales.html.erb | 1 - 7 files changed, 9 insertions(+), 19 deletions(-) diff --git a/app/components/admin/site_customization/information_texts/form_field_component.html.erb b/app/components/admin/site_customization/information_texts/form_field_component.html.erb index 2bda944d7..1852afba0 100644 --- a/app/components/admin/site_customization/information_texts/form_field_component.html.erb +++ b/app/components/admin/site_customization/information_texts/form_field_component.html.erb @@ -4,6 +4,6 @@ text, rows: 5, class: "js-globalize-attribute", - style: site_customization_display_translation_style(locale), + style: site_customization_display_translation_style, data: { locale: locale } %> <% end %> diff --git a/app/components/admin/site_customization/information_texts/form_field_component.rb b/app/components/admin/site_customization/information_texts/form_field_component.rb index f85c1c2ca..69ce896ef 100644 --- a/app/components/admin/site_customization/information_texts/form_field_component.rb +++ b/app/components/admin/site_customization/information_texts/form_field_component.rb @@ -1,6 +1,6 @@ class Admin::SiteCustomization::InformationTexts::FormFieldComponent < ApplicationComponent attr_reader :i18n_content, :locale - use_helpers :globalize, :site_customization_display_translation_style + use_helpers :globalize, :site_customization_enable_translation? def initialize(i18n_content, locale:) @i18n_content = i18n_content @@ -22,4 +22,8 @@ class Admin::SiteCustomization::InformationTexts::FormFieldComponent < Applicati def i18n_text I18n.translate(i18n_content.key, locale: locale) end + + def site_customization_display_translation_style + site_customization_enable_translation?(locale) ? "" : "display: none;" + end end diff --git a/app/helpers/site_customization_helper.rb b/app/helpers/site_customization_helper.rb index 72f00951f..a002071dd 100644 --- a/app/helpers/site_customization_helper.rb +++ b/app/helpers/site_customization_helper.rb @@ -3,10 +3,6 @@ module SiteCustomizationHelper 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 information_texts_tabs [:basic, :debates, :community, :proposals, :polls, :legislation, :budgets, :layouts, :mailers, :management, :welcome, :machine_learning] diff --git a/app/views/admin/legislation/homepages/_form.html.erb b/app/views/admin/legislation/homepages/_form.html.erb index 4a752569c..b2a3e42e5 100644 --- a/app/views/admin/legislation/homepages/_form.html.erb +++ b/app/views/admin/legislation/homepages/_form.html.erb @@ -1,7 +1,4 @@ -<%= render "shared/globalize_locales", - resource: @process, - display_style: lambda { |locale| enable_translation_style(@process, locale) }, - manage_languages: false %> +<%= render "shared/globalize_locales", resource: @process, manage_languages: false %> <%= translatable_form_for [:admin, @process], url: url do |f| %> diff --git a/app/views/admin/legislation/milestones/_summary_form.html.erb b/app/views/admin/legislation/milestones/_summary_form.html.erb index 27442d377..1e6b0b4a9 100644 --- a/app/views/admin/legislation/milestones/_summary_form.html.erb +++ b/app/views/admin/legislation/milestones/_summary_form.html.erb @@ -1,7 +1,4 @@ -<%= render "shared/globalize_locales", - resource: @process, - display_style: lambda { |locale| enable_translation_style(@process, locale) }, - manage_languages: false %> +<%= render "shared/globalize_locales", resource: @process, manage_languages: false %> <%= translatable_form_for [:admin, @process] do |f| %>
diff --git a/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb b/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb index a8afbbebc..8462c141a 100644 --- a/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb +++ b/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb @@ -1,4 +1 @@ -<%= render "shared/common_globalize_locales", - resource: nil, - display_style: lambda { |locale| site_customization_display_translation_style(locale) }, - manage_languages: true %> +<%= render "shared/common_globalize_locales", resource: nil, manage_languages: true %> diff --git a/app/views/shared/_globalize_locales.html.erb b/app/views/shared/_globalize_locales.html.erb index 88aa4064b..32f1b9ce0 100644 --- a/app/views/shared/_globalize_locales.html.erb +++ b/app/views/shared/_globalize_locales.html.erb @@ -1,6 +1,5 @@ <% if translations_interface_enabled? %> <%= render "shared/common_globalize_locales", resource: resource, - display_style: lambda { |locale| enable_translation_style(resource, locale) }, manage_languages: defined?(manage_languages) ? manage_languages : true %> <% end %>