Move template code from lib/Data to template file

Fix #1729 

The template is kept unchanged. Just moved the template code into a new file to separate it form the model

@PVince81 @schiesbn @karlitschek @jancborchardt