Fix problematic applyBindings

https://github.com/dimagi/commcare-hq/pull/5038 exposed a bunch of knockout errors, as detailed [here](https://github.com/dimagi/commcare-hq/pull/5083#issuecomment-67017181).

If you ever get the error `Uncaught Error: You cannot apply bindings multiple times to the same element.`, this PR fixes that a bunch of times, so it makes a good example to work from.

I replicated each of the individual cases fixed here and confirmed that the change fixes them.  Also see changes in ctable: https://github.com/dimagi/ctable/pull/77

The commits are granular, so go commit-by-commit if you like, although it's pretty small.  I did some reindenting on one commit, so you might want `?w=1` in your diff url (like so: https://github.com/dimagi/commcare-hq/pull/5093/files?w=1)