Refactor javascript

- Separate out view models
- Use knockout postbox for event publishing
- Add jasmine tests
- Use require instead of importing js files
- Comply with JS Hint styling