Template instead of jQuery html injection in jp.js

Inject the contents while templating, instead of building the containers and
injecting the contents afterwards.