mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-16 12:49:59 +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,8 +14,9 @@
|
||||||
ago
|
ago
|
||||||
%p.answerbox--question-text= @question.content
|
%p.answerbox--question-text= @question.content
|
||||||
|
|
||||||
- @answers.each do |a|
|
#answers
|
||||||
= render 'shared/answerbox', a: a, show_question: false
|
- @answers.each do |a|
|
||||||
|
= render 'shared/answerbox', a: a, show_question: false
|
||||||
|
|
||||||
- if user_signed_in? and !current_user.answered? @question and current_user != @question.user
|
- if user_signed_in? and !current_user.answered? @question and current_user != @question.user
|
||||||
.panel.panel-default#q-answer-box
|
.panel.panel-default#q-answer-box
|
||||||
|
|
Loading…
Reference in a new issue