From 86ff4eeff94e9a0512361323aa9460d5f1058ad3 Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 14 Sep 2022 11:38:01 +0200 Subject: [PATCH] Add consistency to back_links In some cases (e.g. after editing or creating a resource with errors) the default back_link did not redirect to the expected page. Now we force the back_links to the index pages, so we always get the desired redirect. --- .../questions/answers/documents/index_component.html.erb | 2 +- app/views/admin/poll/polls/edit.html.erb | 2 +- app/views/admin/poll/polls/new.html.erb | 2 +- app/views/admin/poll/questions/answers/edit.html.erb | 2 +- app/views/admin/poll/questions/answers/new.html.erb | 2 +- app/views/admin/poll/questions/answers/videos/edit.html.erb | 2 +- app/views/admin/poll/questions/edit.html.erb | 2 +- app/views/admin/poll/questions/show.html.erb | 2 +- spec/system/admin/poll/polls_spec.rb | 2 ++ spec/system/admin/poll/questions/answers/answers_spec.rb | 4 ++++ .../poll/questions/answers/documents/documents_spec.rb | 1 + .../admin/poll/questions/answers/videos/videos_spec.rb | 2 ++ spec/system/admin/poll/questions_spec.rb | 6 ++++-- 13 files changed, 21 insertions(+), 10 deletions(-) diff --git a/app/components/admin/poll/questions/answers/documents/index_component.html.erb b/app/components/admin/poll/questions/answers/documents/index_component.html.erb index 729d718e3..9c6b95c20 100644 --- a/app/components/admin/poll/questions/answers/documents/index_component.html.erb +++ b/app/components/admin/poll/questions/answers/documents/index_component.html.erb @@ -1,4 +1,4 @@ -<%= back_link_to %> +<%= back_link_to admin_question_path(@answer.question) %>

<%= t("admin.questions.show.answers.documents_list") %>

diff --git a/app/views/admin/poll/polls/edit.html.erb b/app/views/admin/poll/polls/edit.html.erb index f7bd93212..2fd150b35 100644 --- a/app/views/admin/poll/polls/edit.html.erb +++ b/app/views/admin/poll/polls/edit.html.erb @@ -1,4 +1,4 @@ -<%= back_link_to %> +<%= back_link_to admin_polls_path %>

<%= t("admin.polls.edit.title") %>

diff --git a/app/views/admin/poll/polls/new.html.erb b/app/views/admin/poll/polls/new.html.erb index 528b7ff69..899de8223 100644 --- a/app/views/admin/poll/polls/new.html.erb +++ b/app/views/admin/poll/polls/new.html.erb @@ -1,6 +1,6 @@
- <%= back_link_to %> + <%= back_link_to admin_polls_path %>

<%= t("admin.polls.new.title") %>

diff --git a/app/views/admin/poll/questions/answers/edit.html.erb b/app/views/admin/poll/questions/answers/edit.html.erb index def21279d..3abeef3b6 100644 --- a/app/views/admin/poll/questions/answers/edit.html.erb +++ b/app/views/admin/poll/questions/answers/edit.html.erb @@ -1,4 +1,4 @@ -<%= back_link_to %> +<%= back_link_to admin_question_path(@question) %>