Fix is cached template and rerender handling

Previously you would get an ugly unformatted and unclickable rerender
link if a document was cached. This now gives a formated and clickable
link. Also, we no longer fatal when we submit the rerender.

Change-Id: Ibc187acc0d95b6c10dd63e462e93df15ada3e8fe
Merge "Fix is cached template and rerender handling"