Browse Source

Move back link into navigation div

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

9
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") %>
<%= 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 %>
<% end %>

8
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") %>
<%= 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 %>
<% end %>

7
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") %>
<%= 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" } %>

6
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") %>
<%= 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 %>

2
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

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(: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

Loading…
Cancel
Save