codeforamerica/ohana-web-search — pull request #527 by monfresh (2014-07-29 13:53:42+00:00)
Title: Rename organizations to locations. Closes #501.

This started off as a refactor of `organizations_controller`, but to
continue the refactor while having variable names make sense, I had to
do the renaming in this same PR.

Most of the changes in this PR are just renaming of files, directories,
and variables to match what they represent. The other notable changes
are as follows:

- The index action of `locations_controller` is now much cleaner, and
follows Sandi Metz’s rule that a controller should only send one
object/instance variable to the view. This was accomplished by getting
rid of several unused or unnecessary instance variables, and moving the
rest to a Search facade in `app/facades/search.rb`. See this post for
more details about the facade pattern:
http://robots.thoughtbot.com/sandi-metz-rules-for-developers

- Caching code has been removed from the controller because it’s not
clear whether or not it’s implemented correctly, and caching is
probably best left as a decision to each instance maintainer.

- Fixed incorrect URL for language links on details page, and removed unnecessary string replacement.

- Added 3 new partials for the location description, short description,
and hours instead of using the `template` partial which was also being
used for Service fields. The same partial cannot be used for 2
different objects.

- Fixed the missing “hours” icon. By creating a separate partial for
the location hours, it forced me to think about the markup, and allowed
me to realize the icon was missing all along because the template was
being used instead.

- Renamed the variable in the `template` partial, and in the locals
being sent from the `body` partial, to `service` to match the object
they represent.

- Renamed the `urls` partial to `_service_urls` and simplified it to
get rid of unnecessary conditionals.

- Added localization for the location description and service urls
headers (in `en.yml`).

- Added a 301 redirect to replace `organizations` in the URL with
`locations` so that any existing bookmarks or links out there still
work.

- Updated specs and cassettes to use the new controller name