Move information texts form partial to a component
This way it'll be easierto write tests for it when we change it.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<%= render "globalize_locales" %>
|
<%= render Shared::GlobalizeLocalesComponent.new %>
|
||||||
|
|
||||||
<%= form_tag admin_site_customization_information_texts_path do %>
|
<%= form_tag admin_site_customization_information_texts_path do %>
|
||||||
<% I18n.available_locales.each do |l| %>
|
<% I18n.available_locales.each do |l| %>
|
||||||
@@ -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
|
||||||
@@ -43,10 +43,6 @@ module GlobalizeHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def translation_enabled_tag(locale, enabled)
|
|
||||||
hidden_field_tag("enabled_translations[#{locale}]", (enabled ? 1 : 0))
|
|
||||||
end
|
|
||||||
|
|
||||||
def globalize(locale, &)
|
def globalize(locale, &)
|
||||||
Globalize.with_locale(locale, &)
|
Globalize.with_locale(locale, &)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
<%= render Shared::GlobalizeLocalesComponent.new %>
|
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
<%= render "tabs" %>
|
<%= render "tabs" %>
|
||||||
|
|
||||||
<div class="tabs-panel is-active" role="tab">
|
<div class="tabs-panel is-active" role="tab">
|
||||||
<%= render "form", contents: [@content] %>
|
<%= render Admin::SiteCustomization::InformationTexts::FormComponent.new([@content]) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user