diff --git a/app/views/admin/site_customization/information_texts/_form.html.erb b/app/components/admin/site_customization/information_texts/form_component.html.erb similarity index 92% rename from app/views/admin/site_customization/information_texts/_form.html.erb rename to app/components/admin/site_customization/information_texts/form_component.html.erb index b7b4adf5b..b224a0cc1 100644 --- a/app/views/admin/site_customization/information_texts/_form.html.erb +++ b/app/components/admin/site_customization/information_texts/form_component.html.erb @@ -1,4 +1,4 @@ -<%= render "globalize_locales" %> +<%= render Shared::GlobalizeLocalesComponent.new %> <%= form_tag admin_site_customization_information_texts_path do %> <% I18n.available_locales.each do |l| %> diff --git a/app/components/admin/site_customization/information_texts/form_component.rb b/app/components/admin/site_customization/information_texts/form_component.rb new file mode 100644 index 000000000..49521f9e1 --- /dev/null +++ b/app/components/admin/site_customization/information_texts/form_component.rb @@ -0,0 +1,14 @@ +class Admin::SiteCustomization::InformationTexts::FormComponent < ApplicationComponent + attr_reader :contents + use_helpers :site_customization_enable_translation? + + def initialize(contents) + @contents = contents + end + + private + + def translation_enabled_tag(locale, enabled) + hidden_field_tag("enabled_translations[#{locale}]", (enabled ? 1 : 0)) + end +end diff --git a/app/helpers/globalize_helper.rb b/app/helpers/globalize_helper.rb index 1d824fd06..bb6cebb11 100644 --- a/app/helpers/globalize_helper.rb +++ b/app/helpers/globalize_helper.rb @@ -43,10 +43,6 @@ module GlobalizeHelper end end - def translation_enabled_tag(locale, enabled) - hidden_field_tag("enabled_translations[#{locale}]", (enabled ? 1 : 0)) - end - def globalize(locale, &) Globalize.with_locale(locale, &) end 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 deleted file mode 100644 index 1d38894fb..000000000 --- a/app/views/admin/site_customization/information_texts/_globalize_locales.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render Shared::GlobalizeLocalesComponent.new %> diff --git a/app/views/admin/site_customization/information_texts/index.html.erb b/app/views/admin/site_customization/information_texts/index.html.erb index 16d3d7f32..c6a2fea43 100644 --- a/app/views/admin/site_customization/information_texts/index.html.erb +++ b/app/views/admin/site_customization/information_texts/index.html.erb @@ -4,7 +4,6 @@ <%= render "tabs" %> -