handle non-underscored locale names for cktext_area
This commit is contained in:
@@ -35,6 +35,10 @@ module TranslatableFormHelper
|
||||
translatable_field(:text_area, method, options)
|
||||
end
|
||||
|
||||
def translatable_cktext_area(method, options = {})
|
||||
translatable_field(:cktext_area, method, options)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def translatable_field(field_type, method, options = {})
|
||||
@@ -47,7 +51,12 @@ module TranslatableFormHelper
|
||||
final_options = @template.merge_translatable_field_options(options, locale)
|
||||
.reverse_merge(label: label_without_locale)
|
||||
|
||||
@template.concat send(field_type, localized_attr_name, final_options)
|
||||
if field_type == :cktext_area
|
||||
@template.concat content_tag :span, send(field_type, localized_attr_name, final_options),
|
||||
@template.merge_translatable_field_options(options, locale)
|
||||
else
|
||||
@template.concat send(field_type, localized_attr_name, final_options)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,22 +9,7 @@
|
||||
<%= f.translatable_text_field :title %>
|
||||
|
||||
<div class="ckeditor">
|
||||
<%= f.label :description, t("admin.shared.description") %>
|
||||
<% @answer.globalize_locales.each do |locale| %>
|
||||
<% globalize(locale) do %>
|
||||
<%= content_tag :span, class: "js-globalize-attribute",
|
||||
data: { locale: locale },
|
||||
style: display_translation?(locale) do %>
|
||||
|
||||
<%= f.cktext_area "description_#{locale}",
|
||||
maxlength: Poll::Question.description_max_length,
|
||||
ckeditor: { language: locale },
|
||||
class: "js-globalize-attribute",
|
||||
data: { locale: locale },
|
||||
label: false %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= f.translatable_cktext_area :description, maxlength: Poll::Question.description_max_length %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 large-2 margin-top">
|
||||
|
||||
Reference in New Issue
Block a user