mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-21 22:07:48 +01:00
reporting answers works now
This commit is contained in:
parent
9fe827b537
commit
6864faee03
1 changed files with 18 additions and 0 deletions
18
app/assets/javascripts/answerbox/report.coffee
Normal file
18
app/assets/javascripts/answerbox/report.coffee
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
$(document).on "click", "a[data-action=ab-report]", (ev) ->
|
||||||
|
ev.preventDefault()
|
||||||
|
if confirm 'Are you sure you want to report this answer?'
|
||||||
|
btn = $(this)
|
||||||
|
aid = btn[0].dataset.aId
|
||||||
|
$.ajax
|
||||||
|
url: '/ajax/report' # TODO: find a way to use rake routes instead of hardcoding them here
|
||||||
|
type: 'POST'
|
||||||
|
data:
|
||||||
|
id: aid
|
||||||
|
type: 'answer'
|
||||||
|
success: (data, status, jqxhr) ->
|
||||||
|
showNotification data.message, data.success
|
||||||
|
error: (jqxhr, status, error) ->
|
||||||
|
console.log jqxhr, status, error
|
||||||
|
showNotification "An error occurred, a developer should check the console for details", false
|
||||||
|
complete: (jqxhr, status) ->
|
||||||
|
btn.button "reset"
|
Loading…
Reference in a new issue