-
Notifications
You must be signed in to change notification settings - Fork 260
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
Add a way to keep locale querystring when click on search #657
Add a way to keep locale querystring when click on search #657
Conversation
Thanks for this fix! I find that it's mostly working. But there is one test failure. One of the tests uses the search bar and ends up on a page with an invalid locale. I believe this is because no locale is set during most of the tests, and the In the end, a locale with a zero-length/null name is effectively an invalid locale, considering the way we have things coded right now. To avoid this, I think it's best to not include the I have a commit to solve this, let me know if this fix looks good to you, or if you have any issues with this fix: DeeDeeG@dff451d I can probably push that commit to your branch, or you can commit a fix yourself or merge this commit, but I didn't want to do so without asking first. Best Regards, - DeeDeeG |
fd55913
to
22727f9
Compare
@DeeDeeG you can delete this branch if you want! I don't ran the tests before (my bad - sorry!), actually I was looking for the Travis CI result, but it stucks on some kind of build, and then I wait for your response ;) I think your fix is pretty nice, and we can use it, an alternative to it is just add the default language to that hidden field:
|
I will think about which solution to use tomorrow as it is late in my time zone. But then this will be ready to go. With that, all the hard-coded links are gone. The locale switcher should be ready once this fix lands on the locale switcher branch. 🎉 |
Hi again. After testing, I've decided it's best to not set a locale in the search bar, if a locale hasn't been set yet. The problem with falling back to refugerestrooms/app/controllers/application_controller.rb Lines 14 to 15 in 5cff0cb
(Visitors to the site may have a locale auto-determined to be something other than our default: English. In which case the search bar should not send them to the English site.) And writing out all that locale-auto-setting logic here would be code duplication and would be rather verbose. Either we can refactor all that out into a helper (maybe? I've never refactored Ruby/Rails code in that way so I don't know if it makes sense to try it here...) or simply have the search bar not set a locale at all if it's not already set. The "don't set a locale" option makes the most sense to me personally. Though I admit the helper option might be okay. I like simple code, too, and "no helper" is simpler. Describing the problem practically: A user could visit the site at I can amend this Pull Request to the solution I linked to before (DeeDeeG@dff451d) or if you have another idea I'd be open to discuss it as always. Best Regards, - DeeDeeG |
257ff0f
to
2e73937
Compare
2e73937
to
2fe1b2f
Compare
@DeeDeeG after many interactions in this code I think this is the best of it! If you have other use cases please tell me ;) |
More code to review here, I'm thinking it over. Looks like a working design, no bugs, great. 👍 On my mind:
This one is more than I can get to in one day, but hopefully soon. |
@DeeDeeG the ideia behind the There are something I can do to help you to send this whole feature to production? (btw I joined the slack channel, we could talk there) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty straightforward to me.
CC: @DeeDeeG I've pointed this PR to your branch because I've no access to create commits there 😝