added render of the answerbox to the response
This commit is contained in:
parent
e37907f948
commit
88b71d8f31
|
@ -18,6 +18,7 @@ $(document).on "click", "button#q-answer", ->
|
|||
$.ajax
|
||||
url: '/ajax/answer'
|
||||
type: 'POST'
|
||||
dataType: 'json'
|
||||
data:
|
||||
id: qid
|
||||
answer: $("textarea#q-answer[data-id=#{qid}]").val()
|
||||
|
@ -26,6 +27,8 @@ $(document).on "click", "button#q-answer", ->
|
|||
success: (data, status, jqxhr) ->
|
||||
if data.success
|
||||
$("div#q-answer-box").slideUp()
|
||||
# TODO:
|
||||
# ($ "div#q-answer-box").prepend data.render
|
||||
showNotification data.message, data.success
|
||||
error: (jqxhr, status, error) ->
|
||||
console.log jqxhr, status, error
|
||||
|
|
|
@ -41,6 +41,7 @@ class Ajax::AnswerController < ApplicationController
|
|||
@status = :okay
|
||||
@message = "Successfully answered question."
|
||||
@success = true
|
||||
@render = render_to_string(partial: 'shared/answerbox', locals: { a: answer, show_question: false }) unless inbox
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
json.partial! 'ajax/shared/status'
|
||||
json.partial! 'ajax/shared/status'
|
||||
json.render @render if @render
|
Loading…
Reference in New Issue