Skip to content

Instantly share code, notes, and snippets.

@tsgautier
Created October 9, 2012 01:26
Show Gist options
  • Save tsgautier/3856022 to your computer and use it in GitHub Desktop.
Save tsgautier/3856022 to your computer and use it in GitHub Desktop.
ScreenRouter = Backbone.Router.extend(
routes:
"" : "index"
":page": "page"
index: ->
@.navigate("#scores")
page: (page) ->
Session.set('currentPage', page)
)
Router = new ScreenRouter
clickify = -> $("a").click (e) ->
href = $(@).attr('href')
Router.navigate(href, true)
false
<body>
{{> navbar}}
<div style="height: 51px"></div>
{{> pages}}
</body>
<template name="pages">
{{#if pageAbout}}
{{> about}}
{{/if}}
{{#if pageScores}}
{{> scores}}
{{/if}}
</template>
Template.about.rendered = -> clickify()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment