extract base view template for form view

@dannyroberts 

Mostly just moving stuff around. One or two extra boolean flags for the template.