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

Skip populating states select on default country not included in available countries #3030

Conversation

mdesantis
Copy link
Contributor

@mdesantis mdesantis commented Jan 9, 2019

Description

Closes #1205. it:

  • moves available countries retrieving responsibility from base helper to Country model
  • In the case that default country is not included within available countries it leaves the states select empty, where previously was filled in with default country states which didn't match with any available
    country. The state select is later filled in by Select2, which knows which country option is selected. Server side we can't assume that the first country option is selected, because it doesn't play well with client side features, e.g. autocomplete.

Checklist:

  • Pull Request guidelines are respected
  • Documentation/Readme have been updated accordingly
  • Changes are covered by tests (if possible)
  • Each commit has a meaningful message attached that described WHAT changed, and WHY

core/spec/helpers/base_helper_spec.rb Outdated Show resolved Hide resolved
core/spec/helpers/base_helper_spec.rb Outdated Show resolved Hide resolved
core/spec/models/spree/country_spec.rb Outdated Show resolved Hide resolved
core/spec/models/spree/country_spec.rb Outdated Show resolved Hide resolved
core/spec/models/spree/country_spec.rb Outdated Show resolved Hide resolved
core/spec/models/spree/country_spec.rb Outdated Show resolved Hide resolved
core/spec/models/spree/country_spec.rb Outdated Show resolved Hide resolved
core/spec/models/spree/country_spec.rb Outdated Show resolved Hide resolved
@mdesantis mdesantis changed the title Skip setting default state on invalid country Skip setting default state on default country not included in available countries Jan 9, 2019
@mdesantis mdesantis force-pushed the mdesantis/1025/skip-setting-default-state-on-invalid-country branch from 6743379 to 4ecb4cf Compare January 9, 2019 10:31
@mdesantis mdesantis changed the title Skip setting default state on default country not included in available countries Skip setting states on default country not included in available countries Jan 9, 2019
@mdesantis mdesantis changed the title Skip setting states on default country not included in available countries Skip setting states when default country is not included in available countries Jan 9, 2019
@mdesantis mdesantis force-pushed the mdesantis/1025/skip-setting-default-state-on-invalid-country branch from 4ecb4cf to 2c54f53 Compare January 9, 2019 10:42
@mdesantis mdesantis changed the title Skip setting states when default country is not included in available countries Skip populating states select on default country not included in available countries Jan 9, 2019
@mdesantis mdesantis force-pushed the mdesantis/1025/skip-setting-default-state-on-invalid-country branch from 2c54f53 to 9f1d5fb Compare January 9, 2019 14:03
core/spec/helpers/base_helper_spec.rb Outdated Show resolved Hide resolved
core/spec/helpers/base_helper_spec.rb Outdated Show resolved Hide resolved
core/spec/helpers/base_helper_spec.rb Outdated Show resolved Hide resolved
@mdesantis mdesantis force-pushed the mdesantis/1025/skip-setting-default-state-on-invalid-country branch 3 times, most recently from de3934a to 1bd4b36 Compare January 9, 2019 14:12
Closes solidusio#1205. In the case that default country is not included within 
available
countries, this commit leaves the states select empty, where previously 
was
filled in with default country states which didn't match with any 
available
country. The state select is later filled in by Select2, which knows 
which
country option is selected. Server side we can't assume that the first 
country
option is selected, because it doesn't play well with client side 
features, e.g.
autocomplete.
@mdesantis mdesantis force-pushed the mdesantis/1025/skip-setting-default-state-on-invalid-country branch from 1bd4b36 to 8814b86 Compare January 9, 2019 14:13
Copy link
Contributor

@aitbw aitbw left a comment

Choose a reason for hiding this comment

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

Great work @mdesantis ! 🎉

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks @mdesantis !

Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@kennyadsl kennyadsl merged commit aabb096 into solidusio:master Jan 11, 2019
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.

5 participants