Browse Source

Move back link into navigation div

pull/22/head
baarkerlounger 3 years ago
parent
commit
85f7005db0
  1. 5
      app/views/form/questions/economic_status.html.erb
  2. 4
      app/views/form/questions/other_household_members.html.erb
  3. 5
      app/views/form/questions/tenant_ethnic_group.html.erb
  4. 4
      app/views/form/questions/tenant_nationality.html.erb
  5. 2
      db/schema.rb
  6. 9
      spec/features/case_log_spec.rb

5
app/views/form/questions/economic_status.erb → app/views/form/questions/economic_status.html.erb

@ -13,9 +13,12 @@
] %> ] %>
<% previous_question = Form.previous_question("economic_status") %> <% previous_question = Form.previous_question("economic_status") %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> <% content_for :before_content do %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %>
Back Back
<% end %>
<% end %> <% end %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= turbo_frame_tag "case_log_form", target: "_top" do %>
<%= form_with action: '/case_logs', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> <%= 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" } %> <%= 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" } %>

4
app/views/form/questions/other_household_members.erb → app/views/form/questions/other_household_members.html.erb

@ -1,6 +1,8 @@
<% previous_question = Form.previous_question("other_household_members") %> <% previous_question = Form.previous_question("other_household_members") %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> <% content_for :before_content do %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %>
Back Back
<% end %>
<% end %> <% end %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= turbo_frame_tag "case_log_form", target: "_top" do %>

5
app/views/form/questions/tenant_ethnic_group.erb → app/views/form/questions/tenant_ethnic_group.html.erb

@ -21,10 +21,13 @@
] %> ] %>
<% previous_question = Form.previous_question("tenant_ethnic_group") %> <% previous_question = Form.previous_question("tenant_ethnic_group") %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> <% content_for :before_content do %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %>
Back Back
<% end %>
<% end %> <% end %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= turbo_frame_tag "case_log_form", target: "_top" do %>
<%= form_with action: '/case_logs', method: "next_question", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> <%= 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" } %> <%= f.govuk_collection_radio_buttons :tenant_ethnic_group, ethnic_groups, :id, :ethnicity, legend: { text: "What is the tenant’s ethnic group?", size: "l" } %>

4
app/views/form/questions/tenant_nationality.erb → app/views/form/questions/tenant_nationality.html.erb

@ -18,8 +18,10 @@
] %> ] %>
<% previous_question = Form.previous_question("tenant_nationality") %> <% previous_question = Form.previous_question("tenant_nationality") %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %> <% content_for :before_content do %>
<%= govuk_back_link href: "/case_logs/#{case_log_id}/#{previous_question}" do %>
Back Back
<% end %>
<% end %> <% end %>
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= turbo_frame_tag "case_log_form", target: "_top" do %>

2
db/schema.rb

@ -27,6 +27,7 @@ ActiveRecord::Schema.define(version: 2021_09_22_103729) do
t.string "previous_housing_situation" t.string "previous_housing_situation"
t.integer "prior_homelessness" t.integer "prior_homelessness"
t.string "armed_forces" t.string "armed_forces"
t.string "postcode"
t.string "economic_status" t.string "economic_status"
t.integer "number_of_other_members" t.integer "number_of_other_members"
t.string "person_2_relationship" t.string "person_2_relationship"
@ -57,7 +58,6 @@ ActiveRecord::Schema.define(version: 2021_09_22_103729) do
t.integer "person_8_age" t.integer "person_8_age"
t.string "person_8_gender" t.string "person_8_gender"
t.string "person_8_economic" t.string "person_8_economic"
t.string "postcode"
end end
end end

9
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!(:case_log) { FactoryBot.create(:case_log, :in_progress) }
let(:id) { case_log.id } let(:id) { case_log.id }
let(:status) { case_log.status } 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 describe "Create new log" do
it "redirects to the task list for the 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 describe "Form flow is correct" do
it "given an ordered list of pages make sure each leads to the next one in order" 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 { pages[0..-2].each_with_index do |val, index|
|val, index|
visit("/case_logs/#{id}/#{val}") visit("/case_logs/#{id}/#{val}")
click_button("Save and continue") 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 end
end end

Loading…
Cancel
Save