After destroy question redirect to his poll show page

After removing a question from a poll it makes more sense to redirect to
your own poll show page in order to manage their questions.

Currently it is redirecting to the questions index page where all the
questions from all the polls are displayed and takes you completely out
of the context of the poll you are in.

In the future we will remove this index question page.
This commit is contained in:
taitus
2022-09-08 16:40:08 +02:00
parent cc4b22ee37
commit ad9362399e
2 changed files with 4 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController
else else
notice = t("flash.actions.destroy.error") notice = t("flash.actions.destroy.error")
end end
redirect_to admin_questions_path, notice: notice redirect_to admin_poll_path(@question.poll), notice: notice
end end
private private

View File

@@ -147,8 +147,9 @@ describe "Admin poll questions", :admin do
end end
end end
expect(page).not_to have_content(question1.title) expect(page).not_to have_content question1.title
expect(page).to have_content(question2.title) expect(page).to have_content question2.title
expect(page).to have_current_path admin_poll_path(poll)
end end
context "Poll select box" do context "Poll select box" do