Created
March 5, 2012 06:48
-
-
Save anonymous/1977119 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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