Skip to content

Instantly share code, notes, and snippets.

@jdkealy
Created September 1, 2011 17:34
Show Gist options
  • Save jdkealy/1186715 to your computer and use it in GitHub Desktop.
Save jdkealy/1186715 to your computer and use it in GitHub Desktop.
|Blog.Views.Posts ||= {}
|
|class Blog.Views.Posts.PostView extends Backbone.View
| template: JST["backbone/templates/posts/post"]
|
| events:
| "click .destroy" : "destroy"
| "click .edit-post" : "edit"
|
| tagName: "tr"
|
| create: () ->
| alert 'hello'
|
| edit: () ->
| view = new Blog.Views.Posts.EditView(model: @options.model, bound_element: this)
| $("#new-post").html(view.render().el)
|
| destroy: () ->
| @options.model.destroy()
| this.remove()
|
| return false
|
| render: ->
| $(this.el).html(this.template(this.options.model.toJSON() ))
| return this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment