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

[Admin] Handle states_required? in admin address component #5871

Conversation

MadelineCollier
Copy link
Contributor

@MadelineCollier MadelineCollier commented Oct 11, 2024

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:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.28%. Comparing base (7593683) to head (d46369f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5871   +/-   ##
=======================================
  Coverage   89.28%   89.28%           
=======================================
  Files         756      756           
  Lines       17626    17626           
=======================================
  Hits        15737    15737           
  Misses       1889     1889           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.
@MadelineCollier MadelineCollier force-pushed the admin-user-creation-modification branch from 5de4878 to d46369f Compare October 14, 2024 11:41
Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for addressing (pun intended)

@MadelineCollier MadelineCollier merged commit c78a9de into solidusio:main Oct 15, 2024
14 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