Skip to content

Instantly share code, notes, and snippets.

Created March 5, 2012 06:48
Show Gist options
  • Save anonymous/1977119 to your computer and use it in GitHub Desktop.
Save anonymous/1977119 to your computer and use it in GitHub Desktop.
# Backbone.js の依存が気に食わなくて書きなおした版
# clientのcoffeekup に依存
class Model
class View
render: ->
$(@selecter).html CoffeeKup.render @template ,@
class Todo extends Model
constructor:(@name)->
class TodoView extends View
template : ->
ul ->
for todo,n in @todos
li -> h "#{n}:#{todo.name}"
constructor: ->
@selecter = "#content"
@todos = []
@render()
add_todo :(name)->
@todos.push new Todo(name)
@render()
$ ->
todoview = new TodoView
todoview.add_todo("task1")
todoview.add_todo("task2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment