This PR adds enum translation support in tag column and rows, as well as in select input filters. Translation is already supported in formtastic, but this only works for inputs in a form for the model object, when used in filters the object is a Ransack object, and the translation didn't work the same. Changes include:
New EnumUtils with tanslation related methods. The options_for_select method allows for the enum option name or the value in database to be used. This is because the AA filter must use the database value, while the interactive tag_column must use the name
Use of Enum utils in tag builder, including interactive option support
Extension of ActiveAdmin::Inputs::Filters::SelectInput to allow translation when using with an enum and not including collection option
Plus, last three commits include circleci and test suite related fixes.
Question for the reviewer: I'm not sure I put the code of the filter extension where it should be. As it was an extension, I put it in the /support folder, following the example of the RansackFormBuilderExtension. And given that it is changing behavior of an input filter, I put a test for this in spec/features/inputs. Let me know if you would change any of this
@ldlsegovia requested re-review, as I had to include a fix elsewhere for the new tests to pass: default_select setting in select2_spec was leaking to tests that ran after it
This PR adds enum translation support in tag column and rows, as well as in select input filters. Translation is already supported in formtastic, but this only works for inputs in a form for the model object, when used in filters the object is a Ransack object, and the translation didn't work the same. Changes include:
EnumUtils
with tanslation related methods. Theoptions_for_select
method allows for the enum option name or the value in database to be used. This is because the AA filter must use the database value, while the interactivetag_column
must use the nameActiveAdmin::Inputs::Filters::SelectInput
to allow translation when using with an enum and not includingcollection
optionPlus, last three commits include circleci and test suite related fixes.
Question for the reviewer: I'm not sure I put the code of the filter extension where it should be. As it was an extension, I put it in the
/support
folder, following the example of theRansackFormBuilderExtension
. And given that it is changing behavior of an input filter, I put a test for this inspec/features/inputs
. Let me know if you would change any of this