Closed stevenday closed 9 years ago
:+1:
Looks good to me! I don't think there's a stock Rails way of doing this - a quick glance at StackOverflow seems to confirm this - and as we're already using search params, juggling session values just feels like adding more complexity for zero benefit (plus this way it's a shareable/bookmarkable result with the search to retrieve it preserved).
This adds a link to application pages, that takes you back to the search you came from, if the search params are present in the url.
These params are added to the query string of application links in both the list and map views. They're whitelisted in both controllers so that no XSS can happen through adding different parameters and namespaced as search_xxx so that if we ever add url parameters to application pages, these won't clash.
I'm not totally sure about this, as it feels a bit hacky. I guess trying to add state to HTTP always is! I did look at saving the search url in the session instead, but that would have required clearing it in every request too and doing that seemed a bit invasive for this small change.
I'm prepared to find out that there's a very rails way to do this that I've completely overlooked :)
Closes #171