Created
January 10, 2012 19:49
-
-
Save bhuga/1590793 to your computer and use it in GitHub Desktop.
coffeescript parser bug?
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
$ -> | |
class window.Chat extends Backbone.Model | |
class window.ChatList extends Backbone.Collection | |
model: Chat | |
window.chats = new ChatList | |
class window.ChatView extends Backbone.View | |
tagName: 'li' | |
template: _.template($('#chat-template').html()) | |
render: (event) -> | |
@el.html @template(@model.toJSON()) | |
@ | |
### | |
class window.ChatListView extends Backbone.View | |
el: $('#chat-list') | |
initialize: -> | |
@render() | |
chats.bind 'add', @addOne, @ | |
render: (event) -> | |
console.log "rendering whole list, i suppose?" | |
addOne: (chat) -> | |
view = new ChatView({model: chat}) | |
@el.append view.render().el | |
addAll: -> | |
chats.each @addOne | |
### | |
class window.ChatInitializer | |
initialize: -> | |
@el = $('#chat-list') | |
_.each initialChats, (chat) -> | |
view = new ChatView({model: chat }) | |
@el.append view.render().el | |
window.initialChats = [ { nickname: 'bhuga', timeago: 'some while', body: 'woa, some chat mesage, tubular'}] | |
window.chatInitializer = new ChatInitializer |
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
$ -> | |
class window.Chat extends Backbone.Model | |
class window.ChatList extends Backbone.Collection | |
model: Chat | |
window.chats = new ChatList | |
class window.ChatView extends Backbone.View | |
tagName: 'li' | |
template: _.template($('#chat-template').html()) | |
render: (event) -> | |
@el.html @template(@model.toJSON()) | |
@ | |
class window.ChatInitializer | |
initialize: -> | |
@el = $('#chat-list') | |
_.each initialChats, (chat) -> | |
view = new ChatView({model: chat }) | |
@el.append view.render().el | |
window.initialChats = [ { nickname: 'bhuga', timeago: 'some while', body: 'woa, some chat mesage, tubular'}] | |
window.chatInitializer = new ChatInitializer | |
### | |
class window.ChatListView extends Backbone.View | |
el: $('#chat-list') | |
initialize: -> | |
@render() | |
chats.bind 'add', @addOne, @ | |
render: (event) -> | |
console.log "rendering whole list, i suppose?" | |
addOne: (chat) -> | |
view = new ChatView({model: chat}) | |
@el.append view.render().el | |
addAll: -> | |
chats.each @addOne | |
### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment