carte-client
Version:
something like dictionary, wiki, or information card
31 lines (25 loc) • 708 B
text/coffeescript
querystring = require('querystring')
Backbone = require('backbone')
module.exports = class Router extends Backbone.Router
routes:
'tags': 'tags'
'': 'list'
':title': 'show'
':title/history': 'history'
tags: ->
console.log '[router] tags'
= 'tags'
list: (string)->
console.log '[router] list', string
location.hash = '/' if location.hash == ''
= 'list'
= querystring.parse(string)
show: (title, string)->
console.log '[router] show', title
= 'show'
= title
= querystring.parse(string)
history: (title)->
console.log '[router] history', title
= 'history'
= title