mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-16 08:00:02 +01:00
the new answer is now shown
This commit is contained in:
parent
9dc98a3e4e
commit
f53ca1b449
3 changed files with 9 additions and 5 deletions
|
@ -27,8 +27,7 @@ $(document).on "click", "button#q-answer", ->
|
||||||
success: (data, status, jqxhr) ->
|
success: (data, status, jqxhr) ->
|
||||||
if data.success
|
if data.success
|
||||||
$("div#q-answer-box").slideUp()
|
$("div#q-answer-box").slideUp()
|
||||||
# TODO:
|
($ "div#answers").prepend data.render
|
||||||
# ($ "div#q-answer-box").prepend data.render
|
|
||||||
showNotification data.message, data.success
|
showNotification data.message, data.success
|
||||||
error: (jqxhr, status, error) ->
|
error: (jqxhr, status, error) ->
|
||||||
console.log jqxhr, status, error
|
console.log jqxhr, status, error
|
||||||
|
|
|
@ -38,10 +38,14 @@ class Ajax::AnswerController < ApplicationController
|
||||||
services = JSON.parse params[:share]
|
services = JSON.parse params[:share]
|
||||||
ShareWorker.perform_async(current_user.id, answer.id, services)
|
ShareWorker.perform_async(current_user.id, answer.id, services)
|
||||||
|
|
||||||
|
|
||||||
@status = :okay
|
@status = :okay
|
||||||
@message = "Successfully answered question."
|
@message = "Successfully answered question."
|
||||||
@success = true
|
@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
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
ago
|
ago
|
||||||
%p.answerbox--question-text= @question.content
|
%p.answerbox--question-text= @question.content
|
||||||
|
|
||||||
|
#answers
|
||||||
- @answers.each do |a|
|
- @answers.each do |a|
|
||||||
= render 'shared/answerbox', a: a, show_question: false
|
= render 'shared/answerbox', a: a, show_question: false
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue