Files
nairobi/app/assets/javascripts/comments.js.coffee
2015-08-13 18:27:48 +02:00

24 lines
612 B
CoffeeScript

App.Comments =
add_response: (parent_id, response_html) ->
$(response_html).insertAfter($("#js-comment-form-#{parent_id}"))
reset_and_hide_form: (id) ->
form_container = $("#js-comment-form-#{id}")
input = form_container.find("form textarea")
input.val('')
form_container.hide()
reset_form: (id) ->
input = $("#js-comment-form-#{id} form textarea")
input.val('')
toggle_form: (id) ->
$("#js-comment-form-#{id}").toggle()
initialize: ->
$('body').on 'click', '.js-add-comment-link', ->
id = $(this).data().id
App.Comments.toggle_form(id)
false