-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum translations #442
Enum translations #442
Conversation
In display text and also interactive select options
fae4493
to
09ff1ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏻
eq('Archivado, ya no se considera') | ||
) | ||
expect(page.find("#{option_selector}[value='42']").text).to eq('Estado que no existe') | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be good to test that the collection is actually filtered, what do you think? maybe it's not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, especially considering that the filter only works with the db value, that way we make sure it's working. I'll add the test soon before merging
e5ee82e
to
e3f660b
Compare
Was used in paperclip validations, and due to the following bug it is missing from ruby 3.1 image: CircleCI-Public/cimg-ruby#106
e3f660b
to
f2745bc
Compare
@ldlsegovia requested re-review, as I had to include a fix elsewhere for the new tests to pass: default_select setting in |
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