freedomgames/Planet-Lab — pull request #33 by waltaskew (2014-07-23 22:25:46+00:00)
Title: In which we engage in some large, ugly clean up

Depends on https://github.com/freedomgames/Planet-Lab/pull/32

A few things that have popped out at me while messing with front-end stuff that I corrected:

- Angular insists that REST URL's do not end in a trailing slash in $resource. This goes against convention, but we'll do this for Angular as $resource works hard to remove trailing slashes from URL's. This resulted in a big clean-up as I had to make a bunch of back-end unit tests happy with the new url schema by having the tests use the url_for function to generate URL's rather than hand-writing them in the tests (if I had done this more consistently in the first place, this ENORMOUS diff wouldn't be here at all. A majority of the diff is messing with this, so feel free to skip through all of the URL re-writing junk that goes on for a lot of lines.)

- Remove defunct, commented-out routing code
- Make the $resource interface a bit nicer by hiding the backend's refusal to send top-level arrays in API responses (I do not know why the query method in $resource thinks we would do this -- it's a security issue to send top-level arrays rather than objects in JSON.)
- More consistent file names for unit tests

@maiamcguinness