the new answer is now shown

This commit is contained in:
nilsding 2015-01-03 19:14:26 +01:00
parent 9dc98a3e4e
commit f53ca1b449
3 changed files with 9 additions and 5 deletions

View file

@ -27,8 +27,7 @@ $(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
($ "div#answers").prepend data.render
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error

View file

@ -38,10 +38,14 @@ class Ajax::AnswerController < ApplicationController
services = JSON.parse params[:share]
ShareWorker.perform_async(current_user.id, answer.id, services)
@status = :okay
@message = "Successfully answered question."
@success = true
@render = render_to_string(partial: 'shared/answerbox', locals: { a: answer, show_question: false }) unless inbox
unless inbox
@question = 1
@render = render_to_string(partial: 'shared/answerbox', locals: { a: answer, show_question: false })
end
end
def destroy

View file

@ -14,6 +14,7 @@
ago
%p.answerbox--question-text= @question.content
#answers
- @answers.each do |a|
= render 'shared/answerbox', a: a, show_question: false