You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asciinema.org/app/assets/javascripts/backbone/views/comments/comment_entry.js.coffee

31 lines
686 B
CoffeeScript

class AsciiIo.Views.CommentEntry extends AsciiIo.Views.Base
template: JST['backbone/templates/comments/show']
tagName: 'li'
className: 'comment'
events:
'click .remove': 'removeComment'
render: ->
extra =
show_remove_link: @showRemoveLink()
profile_path: "/~#{@model.get('user').nickname}"
context = _.extend(@model.toJSON(), extra)
$(@el).html @template(context)
this
showRemoveLink: ->
@current_user() && ( @current_user().id == @model.user().id )
removeComment: (event) ->
event.preventDefault()
@model.destroy
wait: true
success: =>
$(this.el).slideUp("slow", =>
this.remove()
)