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) %>
- <%= @answer.title %>
diff --git a/app/views/admin/poll/questions/answers/new.html.erb b/app/views/admin/poll/questions/answers/new.html.erb
index c3af00be6..863fdb56c 100644
--- a/app/views/admin/poll/questions/answers/new.html.erb
+++ b/app/views/admin/poll/questions/answers/new.html.erb
@@ -1,4 +1,4 @@
-<%= back_link_to %>
+<%= back_link_to admin_question_path(@question) %>
- <%= @question.title %>
diff --git a/app/views/admin/poll/questions/answers/videos/edit.html.erb b/app/views/admin/poll/questions/answers/videos/edit.html.erb
index 9e6f06a13..39d592ff5 100644
--- a/app/views/admin/poll/questions/answers/videos/edit.html.erb
+++ b/app/views/admin/poll/questions/answers/videos/edit.html.erb
@@ -1,4 +1,4 @@
-<%= back_link_to %>
+<%= back_link_to admin_answer_videos_path(@answer) %>
<%= t("admin.answers.videos.edit.title") %>
diff --git a/app/views/admin/poll/questions/edit.html.erb b/app/views/admin/poll/questions/edit.html.erb
index 52c37badd..6c16a0ddf 100644
--- a/app/views/admin/poll/questions/edit.html.erb
+++ b/app/views/admin/poll/questions/edit.html.erb
@@ -1,4 +1,4 @@
-<%= back_link_to %>
+<%= back_link_to admin_poll_path(@question.poll) %>
<%= t("admin.questions.edit.title") %>
diff --git a/app/views/admin/poll/questions/show.html.erb b/app/views/admin/poll/questions/show.html.erb
index f4e80e14d..954767747 100644
--- a/app/views/admin/poll/questions/show.html.erb
+++ b/app/views/admin/poll/questions/show.html.erb
@@ -1,4 +1,4 @@
-<%= back_link_to %>
+<%= back_link_to admin_poll_path(@question.poll) %>
<%= link_to t("admin.questions.show.edit_question"), edit_admin_question_path(@question),
class: "button hollow float-right" %>
diff --git a/spec/system/admin/poll/polls_spec.rb b/spec/system/admin/poll/polls_spec.rb
index a677ca0cc..ede4bd5f3 100644
--- a/spec/system/admin/poll/polls_spec.rb
+++ b/spec/system/admin/poll/polls_spec.rb
@@ -61,6 +61,7 @@ describe "Admin polls", :admin do
expect(page).not_to have_css("#poll_results_enabled")
expect(page).not_to have_css("#poll_stats_enabled")
+ expect(page).to have_link "Go back", href: admin_polls_path
click_button "Create poll"
@@ -83,6 +84,7 @@ describe "Admin polls", :admin do
end_date = 1.year.from_now.to_date
expect(page).to have_css("img[alt='#{poll.image.title}']")
+ expect(page).to have_link "Go back", href: admin_polls_path
fill_in "Name", with: "Next Poll"
fill_in "poll_ends_at", with: end_date
diff --git a/spec/system/admin/poll/questions/answers/answers_spec.rb b/spec/system/admin/poll/questions/answers/answers_spec.rb
index 1b9722e69..3b12ce770 100644
--- a/spec/system/admin/poll/questions/answers/answers_spec.rb
+++ b/spec/system/admin/poll/questions/answers/answers_spec.rb
@@ -7,6 +7,8 @@ describe "Answers", :admin do
visit admin_question_path(question)
click_link "Add answer"
+ expect(page).to have_link "Go back", href: admin_question_path(question)
+
fill_in "Answer", with: "The answer is always 42"
fill_in_ckeditor "Description", with: "The Hitchhiker's Guide To The Universe"
@@ -39,6 +41,8 @@ describe "Answers", :admin do
visit admin_question_path(question)
within("tr", text: "Answer title") { click_link "Edit" }
+ expect(page).to have_link "Go back", href: admin_question_path(question)
+
fill_in "Answer", with: "New title"
click_button "Save"
diff --git a/spec/system/admin/poll/questions/answers/documents/documents_spec.rb b/spec/system/admin/poll/questions/answers/documents/documents_spec.rb
index 5ab6f11c0..1ab90af53 100644
--- a/spec/system/admin/poll/questions/answers/documents/documents_spec.rb
+++ b/spec/system/admin/poll/questions/answers/documents/documents_spec.rb
@@ -9,6 +9,7 @@ describe "Documents", :admin do
visit admin_answer_documents_path(answer)
expect(page).not_to have_content(document.title)
+ expect(page).to have_link "Go back", href: admin_question_path(answer.question)
end
scenario "Answer with documents" do
diff --git a/spec/system/admin/poll/questions/answers/videos/videos_spec.rb b/spec/system/admin/poll/questions/answers/videos/videos_spec.rb
index 8735e2529..b4d2cdfab 100644
--- a/spec/system/admin/poll/questions/answers/videos/videos_spec.rb
+++ b/spec/system/admin/poll/questions/answers/videos/videos_spec.rb
@@ -28,6 +28,8 @@ describe "Videos", :admin do
visit edit_admin_answer_video_path(answer, video)
+ expect(page).to have_link "Go back", href: admin_answer_videos_path(answer)
+
fill_in "Title", with: title
fill_in "External video", with: url
diff --git a/spec/system/admin/poll/questions_spec.rb b/spec/system/admin/poll/questions_spec.rb
index bbf0eb77e..14a622e37 100644
--- a/spec/system/admin/poll/questions_spec.rb
+++ b/spec/system/admin/poll/questions_spec.rb
@@ -50,8 +50,9 @@ describe "Admin poll questions", :admin do
visit admin_poll_path(poll)
click_link "Edit answers"
- expect(page).to have_content(question.title)
- expect(page).to have_content(question.author.name)
+ expect(page).to have_link "Go back", href: admin_poll_path(poll)
+ expect(page).to have_content question.title
+ expect(page).to have_content question.author.name
end
scenario "Create" do
@@ -123,6 +124,7 @@ describe "Admin poll questions", :admin do
click_link "Edit"
end
+ expect(page).to have_link "Go back", href: admin_poll_path(poll)
old_title = question1.title
new_title = "Potatoes are great and everyone should have one"
fill_in "Question", with: new_title