Sha256: e84f19b66545b7f19fa8adfda8acdcb15e613ae03bfa018c3fe84f5ea252c664

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

querystring = require('querystring')
Backbone = require('backbone')

module.exports = class Router extends Backbone.Router
  routes:
    '': 'list'
    ':title': 'show'
    ':title/history': 'history'

  list: (string)->
    console.log '[router] list', string
    location.hash = '/' if location.hash == ''
    @current = 'list'
    @query = querystring.parse(string)

  show: (title, string)->
    console.log '[router] show', title
    @current = 'show'
    @title = title
    @query = querystring.parse(string)

  history: (title)->
    console.log '[router] history', title
    @current = 'history'
    @title = title

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carte-server-1.0.8 lib/carte/client/router.coffee