Refactor dynamic forms

* Adds publish and submit logic to templates, questions and applications
* Form logic updated
* Unit tests smartened up