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

Has one translations #2200

Merged
merged 1 commit into from
Aug 11, 2022
Merged

Conversation

pablobm
Copy link
Collaborator

@pablobm pablobm commented May 26, 2022

Fixes #2185.

The template app/views/fields/has_one/_show.html.erb wasn't using the correct i18n key to translate the field names of the associated record.

This PR includes a heavy revamp of spec/administrate/views/fields/has_one/_show_spec.rb, which needed some TLC in order to work with it.

The diff for lib/administrate/field/associative.rb looks a bit misleading. The actual change is that I moved the definition of associated_class_name to be above the private declaration.

@pablobm pablobm force-pushed the has-one-translations branch from 423a714 to bf9351f Compare May 26, 2022 14:08
@pablobm pablobm requested a review from nickcharlton July 7, 2022 09:00
@pablobm pablobm assigned pablobm and unassigned nickcharlton Jul 7, 2022
@nickcharlton
Copy link
Member

@pablobm, do you think you could rebase this? I merged in #1941 and I can't work out how to combine them!

@pablobm pablobm force-pushed the has-one-translations branch 2 times, most recently from 3037f03 to 03f5102 Compare August 11, 2022 09:26
@pablobm
Copy link
Collaborator Author

pablobm commented Aug 11, 2022

@nickcharlton I think this is ready now. That was tricky! 😓 There has to be a better way to test this stuff...

@nickcharlton
Copy link
Member

Yeah, they're pretty rough! I didn't even know where to start when I tried myself!

The template `app/views/fields/has_one/_show.html.erb` wasn't using the correct
i18n key to translate the field names of the associated record.

This PR includes a heavy revamp of
`spec/administrate/views/fields/has_one/_show_spec.rb`, which needed some TLC
in order to work with it.

The diff for `lib/administrate/field/associative.rb` looks a bit misleading.
The actual change is the definition of associated_class_name is now above the
private declaration.

Fixes thoughtbot#2185
@nickcharlton nickcharlton merged commit 776a6d5 into thoughtbot:main Aug 11, 2022
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.

I18n translations for nested resources on custom designs not working
2 participants