diff --git a/app/views/form/questions/previous_housing_situation.html.erb b/app/views/form/questions/previous_housing_situation.html.erb index 9b6e3713d..70851a4b2 100644 --- a/app/views/form/questions/previous_housing_situation.html.erb +++ b/app/views/form/questions/previous_housing_situation.html.erb @@ -25,8 +25,10 @@ ] %> <% previous_question = Form.previous_question("previous_housing_situation") %> -<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> - Back +<% content_for :before_content do %> + <%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> + Back + <% end %> <% end %> <%= turbo_frame_tag "case_log_form", target: "_top" do %> diff --git a/app/views/form/questions/tenant_age.html.erb b/app/views/form/questions/tenant_age.html.erb index 12236c363..aabcd39d9 100644 --- a/app/views/form/questions/tenant_age.html.erb +++ b/app/views/form/questions/tenant_age.html.erb @@ -1,6 +1,8 @@ <% previous_question = Form.previous_question("tenant_age") %> -<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> - Back +<% content_for :before_content do %> + <%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> + Back + <% end %> <% end %> <%= turbo_frame_tag "case_log_form", target: "_top" do %> diff --git a/app/views/form/questions/tenant_code.html.erb b/app/views/form/questions/tenant_code.html.erb index eebb74aaa..d13eed35e 100644 --- a/app/views/form/questions/tenant_code.html.erb +++ b/app/views/form/questions/tenant_code.html.erb @@ -1,5 +1,11 @@ +<% previous_question = Form.previous_question("tenant_code") %> +<% content_for :before_content do %> + <%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> + Back + <% end %> +<% end %> + <%= turbo_frame_tag "case_log_form", target: "_top" do %> - <%= render GovukComponent::BackLinkComponent.new(href: "/case_logs/#{case_log_id}", text: 'Back') do %><% end %> <%= form_with action: '/case_logs', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> <%= f.govuk_text_field :tenant_code, hint: { text: "More detail" }, diff --git a/app/views/form/questions/tenant_gender.html.erb b/app/views/form/questions/tenant_gender.html.erb index 73fdb86f0..e01b7aa41 100644 --- a/app/views/form/questions/tenant_gender.html.erb +++ b/app/views/form/questions/tenant_gender.html.erb @@ -6,8 +6,10 @@ ] %> <% previous_question = Form.previous_question("tenant_gender") %> -<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> - Back +<% content_for :before_content do %> + <%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> + Back + <% end %> <% end %> <%= turbo_frame_tag "case_log_form", target: "_top" do %> diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index 7b24baa74..cb9f49e5d 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -38,19 +38,19 @@ RSpec.describe "Test Features" do expect(page).to have_field("tenant-age-field") end end - end - describe "Back link directs correctly" do - it "go back to tasklist page from tenant code" do - visit("/case_logs/#{id}/tenant_code") - click_link(text: 'Back') - expect(page).to have_content("Tasklist for log #{id}") - end + describe "Back link directs correctly" do + it "go back to tasklist page from tenant code" do + visit("/case_logs/#{id}/tenant_code") + click_link(text: 'Back') + expect(page).to have_content("Tasklist for log #{id}") + end - it "go back to tenant code page from tenant age page" do - visit("/case_logs/#{id}/tenant_age") - click_link(text: 'Back') - expect(page).to have_field("tenant-code-field") + it "go back to tenant code page from tenant age page" do + visit("/case_logs/#{id}/tenant_age") + click_link(text: 'Back') + expect(page).to have_field("tenant-code-field") + end end end end