Remove legacy question TypeScript
This commit is contained in:
parent
a6bc27e884
commit
721b7f3657
|
@ -1,37 +0,0 @@
|
||||||
$(document).on "keydown", "textarea#q-answer-text", (evt) ->
|
|
||||||
qid = $(this)[0].dataset.id
|
|
||||||
if evt.keyCode == 13 and evt.ctrlKey
|
|
||||||
# trigger warning:
|
|
||||||
$("button#q-answer-btn").trigger 'click'
|
|
||||||
|
|
||||||
|
|
||||||
$(document).on "click", "button#q-answer-btn", ->
|
|
||||||
btn = $(this)
|
|
||||||
btn.button "loading"
|
|
||||||
qid = btn[0].dataset.qId
|
|
||||||
$("textarea#q-answer-text").attr "readonly", "readonly"
|
|
||||||
|
|
||||||
shareTo = []
|
|
||||||
($ "input[type=checkbox][name=share][data-q-id=#{qid}]:checked").each (i, share) ->
|
|
||||||
shareTo.push share.dataset.service
|
|
||||||
|
|
||||||
$.ajax
|
|
||||||
url: '/ajax/answer'
|
|
||||||
type: 'POST'
|
|
||||||
dataType: 'json'
|
|
||||||
data:
|
|
||||||
id: qid
|
|
||||||
answer: $("textarea#q-answer-text[data-id=#{qid}]").val()
|
|
||||||
share: JSON.stringify shareTo
|
|
||||||
inbox: false
|
|
||||||
success: (data, status, jqxhr) ->
|
|
||||||
if data.success
|
|
||||||
$("div#q-answer-box").slideUp()
|
|
||||||
($ "div#answers").prepend data.render
|
|
||||||
showNotification data.message, data.success
|
|
||||||
error: (jqxhr, status, error) ->
|
|
||||||
console.log jqxhr, status, error
|
|
||||||
showNotification translate('frontend.error.message'), false
|
|
||||||
complete: (jqxhr, status) ->
|
|
||||||
btn.button "reset"
|
|
||||||
$("textarea#q-answer-text").removeAttr "readonly"
|
|
|
@ -26,7 +26,6 @@ import '../legacy/answerbox'
|
||||||
import '../legacy/memes'
|
import '../legacy/memes'
|
||||||
import '../legacy/notifications'
|
import '../legacy/notifications'
|
||||||
import '../legacy/pagination'
|
import '../legacy/pagination'
|
||||||
import '../legacy/question'
|
|
||||||
import '../legacy/settings'
|
import '../legacy/settings'
|
||||||
import '../legacy/report'
|
import '../legacy/report'
|
||||||
import '../legacy/locale-box'
|
import '../legacy/locale-box'
|
||||||
|
|
Loading…
Reference in New Issue