Allow to delete answers if the poll has not started yet

Deleting answers was not even possible. But it was possible to delete
questions. So we implemented the same behavior.
This commit is contained in:
Julian Herrero
2022-02-26 17:41:37 +07:00
committed by Javi Martín
parent 3a6e99cb8c
commit 14542df0de
10 changed files with 52 additions and 5 deletions

View File

@@ -30,6 +30,11 @@ class Admin::Poll::Questions::AnswersController < Admin::Poll::BaseController
end
end
def destroy
@answer.destroy!
redirect_to admin_question_path(@question), notice: t("admin.answers.destroy.success_notice")
end
def order_answers
::Poll::Question::Answer.order_answers(params[:ordered_list])
head :ok