Sha256: d297626a4702d5d58cd457a30ba9cd0d9f3180829e604ca25ea1bcfab28c04fe
Contents?: true
Size: 756 Bytes
Versions: 15
Compression:
Stored size: 756 Bytes
Contents
$ -> PostsApp.PostsIndexView = Backbone.View.extend initialize: -> _.bindAll(this, 'addPost', 'addAllPosts', 'removePost') PostsApp.Posts.on('add', this.addPost, this) PostsApp.Posts.on('remove', this.removePost, this) PostsApp.Posts.on('reset', this.addAllPosts, this) template: JST["crowdblog/templates/posts/index"] render: -> this.$el.html(this.template()) this addPost: (post) -> elementId = 'post-' + post.id post_view = new PostsApp.PostView model: post id: elementId this.$el.find('tbody').append(post_view.render().el) addAllPosts: -> PostsApp.Posts.each(this.addPost) removePost: (post) -> this.$('#post-' + post.id).remove()
Version data entries
15 entries across 15 versions & 1 rubygems