diff --git a/README.md b/README.md index 4071961e..cd7fa555 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,6 @@ end ``` ## In your Active Admin resource definition -**Important note:** I'm working on a fix for #4 because after AA deprecated and then removed [#form_buffers](https://github.com/activeadmin/activeadmin/pull/3486) the -syntax shown below for form declaration doesn't work as is. See comments in code and [discussion](#4) to fix it until I found a solution. - ```ruby # For usage with strong parameters you'll need to permit them @@ -54,7 +51,6 @@ index do actions end -# This was the original syntax proposed in this gem, however currently it doesn't work form do |f| # ... f.translated_inputs "Translated fields", switch_locale: false do |t| @@ -64,19 +60,6 @@ form do |f| # ... end -# Instead you have to nest the block inside an #inputs block and the title -# should be passed to the inputs method -form do |f| - # ... - f.inputs "Translated fields" do - f.translated_inputs 'ignored title', switch_locale: false do |t| - t.input :title - t.input :description - end - end - # ... -end - # You can also set locales to show in tabs # For example we want to show English translation fields without tab, and want to show other languages within tabs form do |f| diff --git a/lib/active_admin/globalize/form_builder_extension.rb b/lib/active_admin/globalize/form_builder_extension.rb index e68aaef2..5a78d4d0 100644 --- a/lib/active_admin/globalize/form_builder_extension.rb +++ b/lib/active_admin/globalize/form_builder_extension.rb @@ -8,6 +8,10 @@ def translated_inputs(name = "Translations", options = {}, &block) available_locales = options.fetch(:available_locales, I18n.available_locales) switch_locale = options.fetch(:switch_locale, false) default_locale = options.fetch(:default_locale, I18n.default_locale) + if block_given? + # If this translated_inputs is nested inside an inputs, AA has already set this + template.assigns[:has_many_block] = true + end template.content_tag(:div, class: "activeadmin-translations") do template.content_tag(:ul, class: "available-locales") do available_locales.map do |locale|