Update poll question answers translatable fields
We needed to bring back support for CKEditor in our translatable form, which we had temporarily remove. And now we support CKEditor in our translatable specs, and so we can remove the duplicated specs for poll question answers.
This commit is contained in:
@@ -11,9 +11,10 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
||||
|
||||
def create
|
||||
@answer = ::Poll::Question::Answer.new(answer_params)
|
||||
@question = @answer.question
|
||||
|
||||
if @answer.save
|
||||
redirect_to admin_question_path(@answer.question),
|
||||
redirect_to admin_question_path(@question),
|
||||
notice: t("flash.actions.create.poll_question_answer")
|
||||
else
|
||||
render :new
|
||||
@@ -31,7 +32,7 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
||||
redirect_to admin_question_path(@answer.question),
|
||||
notice: t("flash.actions.save_changes.notice")
|
||||
else
|
||||
redirect_to :back
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,8 +51,8 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
|
||||
|
||||
def answer_params
|
||||
documents_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
|
||||
attributes = [:title, :description, :question_id, documents_attributes: documents_attributes]
|
||||
params.require(:poll_question_answer).permit(*attributes, *translation_params(Poll::Question::Answer))
|
||||
attributes = [:question_id, documents_attributes: documents_attributes]
|
||||
params.require(:poll_question_answer).permit(*attributes, translation_params(Poll::Question::Answer))
|
||||
end
|
||||
|
||||
def load_answer
|
||||
|
||||
Reference in New Issue
Block a user