Sha256: c3283f3011a71c242dca2c112978ca3253bf4401ca2a3102e0741878cbf67b57

Contents?: true

Size: 708 Bytes

Versions: 3

Compression:

Stored size: 708 Bytes

Contents

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'
    @current = 'tags'

  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

3 entries across 3 versions & 1 rubygems

Version Path
carte-server-1.0.11 lib/carte/client/router.coffee
carte-server-1.0.10 lib/carte/client/router.coffee
carte-server-1.0.9 lib/carte/client/router.coffee