[Admin] Handle states_required? in admin address component #5871
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR is loosely related to issue #5824.
It builds off of review feedback from this PR: #5865
Handle states_required? in admin address component
Previously, this component would just disable the state_id field when
the selected country did not require states, but this meant that the
user would never be able to self-fill the state_name field, which is
something that some stores can require with the
Spree::Config[:address_requires_state]
preference.The component now takes this into account and will swap between a
state_id dropdown select field, or a blank state_name text input
depending on the country the user has selected.
This brings this new admin component up to par with the previous backend
address forms.
Screenshots
Screen.Recording.2024-10-11.at.5.01.25.PM.mov
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: