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

Refactor localised admin forms #8150

Merged
merged 6 commits into from
Mar 13, 2024
Merged

Refactor localised admin forms #8150

merged 6 commits into from
Mar 13, 2024

Conversation

gbp
Copy link
Member

@gbp gbp commented Mar 5, 2024

What does this do?

Refactor localised admin forms

Why was this needed?

To reduce complexity and make the forms consistent with each other.

Implementation notes

Switches admin forms with translated fields to use the translated_form_for form builder and translated_fields form helper. Means we don't have to manually build the tabbed interface for the different locales in use.

This is already in use for the OutgoingMessage::Snippet forms and can be re-used for Announcement Category, PublicBody and Note forms.


[skip changelog]

gbp added 6 commits March 5, 2024 10:49
Reduce indentation which will make future commit diffs clearer.
Use existing locale_fields partial with minor changes as this needs to
work within the `translated_fields` form builder helper.
Use our `translated_form_for` helper and `translated_fields` form build
helper so we don't have to manually create the locale tabbed interface
for translated form fields.
Need to call `#build_all_translations` so the form is re-rendered
correctly after validation errors.
Use translated_form_for error_messages helper to generate list of issues
stopping the form from being submitted.
@garethrees
Copy link
Member

Haven't checked thoroughly but looks good in principle!

@gbp gbp merged commit 41b57aa into develop Mar 13, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants