Skip to content
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

Support multiple translated_inputs #31

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

tkalliom
Copy link

Use case: we had a previously monolingual application with a model with lots of attributes, presented in a specific order on the admin page. Adding translations, usage of activeadmin-globalize would have required to move all translation fields to a single section on the page, breaking earlier order. We wanted to have non-consecutive translated inputs, but it turned out that adding multiple translated_inputs resulted in trying to add multiple translation records per locale.

This patch makes the field names use keys generated from the locale, rather than the default incrementing integers. This way, even when multiple translation blocks are added, the same key ensures that the POSTed data is interpreted correctly by the server. Most of the changes were actually to the JS side: locale tab rendering and on-submit data filtering.

@tkalliom
Copy link
Author

This was done only taking into account multiple groups of attributes for a single record; probably this should be handled together with has_many support (#5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant