use url reverse lookups for client side requests

Solves #1955. Basically just port everything to use reverse url lookup vars defined in base.html.