Skip to content

Instantly share code, notes, and snippets.

@lawrencepit
Created October 17, 2011 01:04
Show Gist options
  • Save lawrencepit/1291681 to your computer and use it in GitHub Desktop.
Save lawrencepit/1291681 to your computer and use it in GitHub Desktop.
initialize: () ->
_.bindAll(this, 'addOne', 'addAll', 'render')
@options.posts.bind('reset', @addAll)
addAll: () ->
@options.posts.each(@addOne)
addOne: (post) ->
view = new Blog.Views.Posts.PostView({model : post})
@$("tbody").append(view.render().el)
render: ->
$(@el).html(@template(posts: @options.posts.toJSON() ))
@addAll()
return this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment