Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Article = require('models/article').Article
- class exports.ArticleRouter extends Backbone.Router
- routes :
- "/articles": "index"
- "/articles/:id": "show"
- "/articles/:id/edit": "edit"
- "/articles/:id/delete": "delete"
- index: ->
- console.log 'list articles'
- app.collections.articles.fetch()
- app.views.articles.render()
- show: (id) ->
- console.log 'show article' + id
- if not article = app.collections.articles.get(id):
- article = new Article(id: id)
- article.fetch
- success: (model, response) ->
- app.collections.articles.add(article)
- console.log model
- error: (model, response) ->
- console.log 'error!!!'
- edit: (id) ->
- console.log 'edit article' + id
- delete: (id) ->
- console.log 'delete article' + id
Add Comment
Please, Sign In to add comment