fixes #4256 - makes columns sortable in the UI

Adds `counter_cache` to a bunch of models to make them sortable on has_many relationship counts.  Also adds some other missing sorts in the UI.

Due to the way scoped_search works, the counts need to be retrievable from the DB. Are there downsides to using counter caches, which is why this was all in the controllers?