mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:29:52 +01:00
JS
This commit is contained in:
parent
4476e54ca5
commit
3994bdeb02
1 changed files with 20 additions and 0 deletions
|
@ -75,6 +75,26 @@ $(document).on "click", "button[name=ib-answer]", ->
|
|||
btn.button "reset"
|
||||
$("textarea[name=ib-answer][data-id=#{iid}]").removeAttr "readonly"
|
||||
|
||||
# TODO
|
||||
$(document).on "click", "button[name=ab-destroy]", ->
|
||||
btn = $(this)
|
||||
btn.button "loading"
|
||||
aid = btn[0].dataset.aId
|
||||
$.ajax
|
||||
url: '/ajax/destroy_answer' # TODO: find a way to use rake routes instead of hardcoding them here
|
||||
type: 'POST'
|
||||
data:
|
||||
answer: aid
|
||||
success: (data, status, jqxhr) ->
|
||||
if data.success
|
||||
$("div.answer-box[data-id=#{aid}]").slideUp()
|
||||
showSnackbar data.message
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
showSnackbar "An error occurred, a developer should check the console for details"
|
||||
complete: (jqxhr, status) ->
|
||||
btn.button "reset"
|
||||
|
||||
$(document).on "click", "button#create-account", ->
|
||||
Turbolinks.visit "/sign_up"
|
||||
|
||||
|
|
Loading…
Reference in a new issue