mysociety/planningalerts-app — pull request #69 by stevenday (2014-10-09 13:57:29+00:00)
Title: Add a search widget to the search page

:WIP:! Needs some updated (and more) tests and the redirect-after-searching
business removing

Underneath this innocuous title I found a little bit of a rabbit hole, but I
think I've come out of it with something cleaner than what we had before.

I've moved all searching under one controller action (`#search`) so that the
homepage and the subsequent results are served by the same page, with a
variety of partial views to make that tidy. This simplifies the logic for
dealing with people searching again from the search page and adding filters etc
to it.

It also allows us the potential (one day) to do a flashy homepage where the
map is "real" behind the search box and animates away with JS to reveal the
results.

I had to hack the routes slightly to achieve this, but as a reward we now only
override one controller action (search) which Open Australia probably want to
change anyway, so it should be easier to merge upstream.

As part of this I also fixed up a bug with the map pin javascript by making it
not print invalid javascript when there are no results for a search.

I also improved the select2 experience slightly by making it add some helpful
text around the custom search query option it builds, so that it's more obvious
it's going to do a search with it.

Closes #57