move more view logic out of app.js and into view