Moving some boilerplate from the views to templates/init.js