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

Implement Country/State select ability (higher priority) #1170

Closed
kasugaijin opened this issue Nov 21, 2024 · 4 comments
Closed

Implement Country/State select ability (higher priority) #1170

kasugaijin opened this issue Nov 21, 2024 · 4 comments
Assignees

Comments

@kasugaijin
Copy link
Collaborator

kasugaijin commented Nov 21, 2024

We currently use city-state gem to get a list of states for a given selected country. However, this gem is not reliable in production and this thread does not inspire confidence in the long run. So, we will keep things simple and roll our own. This is currently affecting the production app, so would be great to resolve sooner than later!

This is a two-part issue

Part 1)

  • remove the city-state gem
  • remove the routes for countries and states
  • remove the states controller and its associated view
  • remove states tests

Part 2)

  • we only use the country and state form fields for the Organization. This is on two forms (organization settings staff/organization/edit and organization account request organization_account_request/new)
  • update the form selects so countries options are Canada, USA, Mexico (only these for now)
  • states - use stimulus to dynamically update the state select to only show the values for the states of the selected country. So, if I select USA, it updates the State select to show USA states.
  • States should be displayed with their full name e.g. California, but saved with their abbreviation CA

Tip: To get a full list of the states for each country, use the city-state gem in your rails console to get the values i.e., CS.states(:US) will give you the states for USA. Then you can use these in Stimulus.

@kasugaijin kasugaijin added the Ready Make a comment to get assigned. label Nov 21, 2024
@kasugaijin kasugaijin changed the title Implement Country/State select ability Implement Country/State select ability (higher priority) Nov 21, 2024
@sarvaiyanidhi
Copy link
Contributor

@kasugaijin I can take up this issue.. Can you please assign it to me?

@kasugaijin
Copy link
Collaborator Author

@sarvaiyanidhi all yours!

@kasugaijin kasugaijin removed the Ready Make a comment to get assigned. label Nov 22, 2024
@mononoken
Copy link
Collaborator

FYI, @sarvaiyanidhi:

Just merged #1169 which added some city-state usage in the fosterer edit form and fosterer invite form. It also touched the country_state_controller.js a little. Hopefully, it's not too much work for you. Thank you!

@sarvaiyanidhi
Copy link
Contributor

Thanks for the heads up @mononoken .. Will check this form as well while implementing the changes.

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

No branches or pull requests

4 participants