Skip to content

Instantly share code, notes, and snippets.

@jhubert
Created April 23, 2012 23:22
Show Gist options
  • Save jhubert/2474499 to your computer and use it in GitHub Desktop.
Save jhubert/2474499 to your computer and use it in GitHub Desktop.
Robots.Views.HomePage = Backbone.RobotView.extend
template: Handlebars.compile($('#t-home-page').html())
events:
"click #dashboard-link" : "goDashboard"
initialize: ->
@render()
render: ->
console.log 'rendering homepage'
@$el.html(@template())
this
goDashboard: ->
Robots.app.navigate('dashboard', { trigger : true })
Robots.Routers.Entries = Backbone.Router.extend
views: {}
routes:
'': 'showHomePage'
'dashboard': 'showDashboard'
showHomePage: ->
if views['showHomePage']
views['showHomePage'].render()
else
views['showHomePage'] = new Robots.Views.HomePage()
showDashboard: ->
new Robots.Views.Dashboard()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment