diff --git a/app/views/form/questions/economic_status.erb b/app/views/form/questions/economic_status.html.erb similarity index 90% rename from app/views/form/questions/economic_status.erb rename to app/views/form/questions/economic_status.html.erb index 3ffd86d18..4558cc54e 100644 --- a/app/views/form/questions/economic_status.erb +++ b/app/views/form/questions/economic_status.html.erb @@ -13,9 +13,12 @@ ] %> <% previous_question = Form.previous_question("economic_status") %> -<%= 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 %> <%= form_with action: '/case_logs', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> <%= f.govuk_collection_radio_buttons :economic_status, economic_statuses, :id, :ethnicity, legend: { text: "Which of these best describes the tenant's working situation?", size: "l" } %> @@ -23,4 +26,4 @@ <%= f.hidden_field :case_log_id, value: case_log_id %> <%= f.govuk_submit "Save and continue" %> <% end %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/form/questions/other_household_members.erb b/app/views/form/questions/other_household_members.html.erb similarity index 82% rename from app/views/form/questions/other_household_members.erb rename to app/views/form/questions/other_household_members.html.erb index 1bc601818..335da40ed 100644 --- a/app/views/form/questions/other_household_members.erb +++ b/app/views/form/questions/other_household_members.html.erb @@ -1,6 +1,8 @@ <% previous_question = Form.previous_question("other_household_members") %> -<%= 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 %> @@ -14,4 +16,4 @@ <%= f.hidden_field :case_log_id, value: case_log_id %> <%= f.govuk_submit "Save and continue" %> <% end %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/form/questions/tenant_ethnic_group.erb b/app/views/form/questions/tenant_ethnic_group.html.erb similarity index 93% rename from app/views/form/questions/tenant_ethnic_group.erb rename to app/views/form/questions/tenant_ethnic_group.html.erb index 237a34640..233861f8f 100644 --- a/app/views/form/questions/tenant_ethnic_group.erb +++ b/app/views/form/questions/tenant_ethnic_group.html.erb @@ -21,10 +21,13 @@ ] %> <% previous_question = Form.previous_question("tenant_ethnic_group") %> -<%= 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 %> <%= form_with action: '/case_logs', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> <%= f.govuk_collection_radio_buttons :tenant_ethnic_group, ethnic_groups, :id, :ethnicity, legend: { text: "What is the tenant’s ethnic group?", size: "l" } %> diff --git a/app/views/form/questions/tenant_nationality.erb b/app/views/form/questions/tenant_nationality.html.erb similarity index 92% rename from app/views/form/questions/tenant_nationality.erb rename to app/views/form/questions/tenant_nationality.html.erb index 3ea00a9ba..61c7e5cc1 100644 --- a/app/views/form/questions/tenant_nationality.erb +++ b/app/views/form/questions/tenant_nationality.html.erb @@ -18,8 +18,10 @@ ] %> <% previous_question = Form.previous_question("tenant_nationality") %> -<%= 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/db/schema.rb b/db/schema.rb index 7d92915dc..7d2d8b835 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -27,6 +27,7 @@ ActiveRecord::Schema.define(version: 2021_09_22_103729) do t.string "previous_housing_situation" t.integer "prior_homelessness" t.string "armed_forces" + t.string "postcode" t.string "economic_status" t.integer "number_of_other_members" t.string "person_2_relationship" @@ -57,7 +58,6 @@ ActiveRecord::Schema.define(version: 2021_09_22_103729) do t.integer "person_8_age" t.string "person_8_gender" t.string "person_8_economic" - t.string "postcode" end end diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index f02326646..fefb89288 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "Test Features" do let!(:case_log) { FactoryBot.create(:case_log, :in_progress) } let(:id) { case_log.id } let(:status) { case_log.status } - pages = ['tenant_code', 'tenant_age', 'tenant_gender', 'tenant_ethnic_group', 'tenant_nationality', 'economic_status', 'other_household_members'] + pages = %w[tenant_code tenant_age tenant_gender tenant_ethnic_group tenant_nationality economic_status other_household_members] describe "Create new log" do it "redirects to the task list for the new log" do @@ -57,12 +57,11 @@ RSpec.describe "Test Features" do describe "Form flow is correct" do it "given an ordered list of pages make sure each leads to the next one in order" do - pages[0..-2].each_with_index { - |val, index| + pages[0..-2].each_with_index do |val, index| visit("/case_logs/#{id}/#{val}") click_button("Save and continue") - expect(page).to have_current_path("/case_logs/#{id}/#{pages[index+1]}") - } + expect(page).to have_current_path("/case_logs/#{id}/#{pages[index + 1]}") + end end end end