diff --git a/Gemfile b/Gemfile index 3c8d77954..dcb8a18b3 100644 --- a/Gemfile +++ b/Gemfile @@ -34,6 +34,7 @@ gem "roo" # Json Schema gem "json-schema" gem "uk_postcode" +gem "turbo-rails", "~> 0.8" group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Gemfile.lock b/Gemfile.lock index 04db4e6f3..04961facf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/rspec/rspec-core.git - revision: 42a9fe3a2dc9d5e68811ee646f4b9b4349c18b24 + revision: e36aa2a9ebe68acee3ce05190fc2124947b45925 branch: main specs: rspec-core (3.11.0.pre) @@ -26,7 +26,7 @@ GIT GIT remote: https://github.com/rspec/rspec-rails.git - revision: cfe4db707cc5a0c9437aa90e3059256f30368da4 + revision: d3e7b85877fcbcec63f8a76434d8750e7f3b7aef branch: main specs: rspec-rails (5.1.0.pre) @@ -136,7 +136,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - chartkick (4.1.0) + chartkick (4.1.2) childprocess (4.1.0) coderay (1.1.3) concurrent-ruby (1.1.9) @@ -170,7 +170,7 @@ GEM activemodel (>= 6.0) railties (>= 6.0) view_component (~> 2.39.0) - govuk_design_system_formbuilder (2.7.5) + govuk_design_system_formbuilder (2.7.6) actionview (>= 6.0) activemodel (>= 6.0) activesupport (>= 6.0) @@ -190,7 +190,7 @@ GEM railties (>= 5.2, < 6.2) responders (>= 2, < 4) iniparse (1.5.0) - jbuilder (2.11.2) + jbuilder (2.11.3) activesupport (>= 5.0.0) jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) @@ -225,8 +225,6 @@ GEM minitest (5.14.4) msgpack (1.4.2) nio4r (2.5.8) - nokogiri (1.12.5-x86_64-darwin) - racc (~> 1.4) nokogiri (1.12.5-x86_64-linux) racc (~> 1.4) overcommit (0.58.0) @@ -297,35 +295,34 @@ GEM roo (2.8.3) nokogiri (~> 1) rubyzip (>= 1.3.0, < 3.0.0) - rubocop (1.21.0) + rubocop (1.23.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.9.1, < 2.0) + rubocop-ast (>= 1.12.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.11.0) + rubocop-ast (1.13.0) parser (>= 3.0.1.1) - rubocop-govuk (4.1.0) - rubocop (= 1.21.0) - rubocop-ast (= 1.11.0) - rubocop-rails (= 2.12.2) + rubocop-govuk (4.2.0) + rubocop (= 1.23.0) + rubocop-ast (= 1.13.0) + rubocop-rails (= 2.12.4) rubocop-rake (= 0.6.0) - rubocop-rspec (= 2.4.0) + rubocop-rspec (= 2.6.0) rubocop-performance (1.12.0) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.12.2) + rubocop-rails (2.12.4) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.7.0, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.4.0) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) + rubocop-rspec (2.6.0) + rubocop (~> 1.19) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) rubyzip (2.3.2) @@ -352,14 +349,14 @@ GEM sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.0) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - stimulus-rails (0.7.1) + stimulus-rails (0.7.2) rails (>= 6.0.0) thor (1.1.0) - turbo-rails (7.1.1) + turbo-rails (0.8.3) rails (>= 6.0.0) tzinfo (2.0.4) concurrent-ruby (~> 1.0) @@ -368,7 +365,7 @@ GEM view_component (2.39.0) activesupport (>= 5.0.0, < 8.0) method_source (~> 1.0) - web-console (4.1.0) + web-console (4.2.0) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) @@ -386,8 +383,6 @@ GEM zeitwerk (2.5.1) PLATFORMS - x86_64-darwin-19 - x86_64-darwin-20 x86_64-linux DEPENDENCIES @@ -424,6 +419,7 @@ DEPENDENCIES scss_lint-govuk selenium-webdriver simplecov + turbo-rails (~> 0.8) tzinfo-data uk_postcode web-console (>= 4.1.0) diff --git a/README.md b/README.md index c1afaf7f5..6e472e56c 100644 --- a/README.md +++ b/README.md @@ -135,10 +135,7 @@ The JSON should follow the structure: } } }, - "conditional_route_to": { - "[page_name_to_route_to]": {"question_name": "expected_answer"}, - "[page_name_to_route_to]": {"question_name": "expected_answer"} - } + "depends_on": { "question_key": "answer_value_required_for_this_page_to_be_shown" } } } } @@ -160,12 +157,25 @@ Assumptions made by the format: - Radio question answer option selected matches one of conditional e.g. ["answer-options-1-string", "answer-option-3-string"] - Numeric question value matches condition e.g. [">2"], ["<7"] or ["== 6"] + Page routing: + + - Form navigation works by stepping sequentially through every page defined in the JSON form definition for the given subsection. For every page it checks if it has "depends_on" conditions. If it does, it evaluates them to determine whether that page should be show or not. + + - In this way we can build up whole branches by having: + + ```jsonc + "page_1": { "questions": { "question_1: "answer_options": ["A", "B"] } }, + "page_2": { "questions": { "question_2: "answer_options": ["C", "D"] }, "depends_on": { "question_1": "A" } }, + "page_3": { "questions": { "question_3: "answer_options": ["E", "F"] }, "depends_on": { "question_1": "A" } }, + "page_4": { "questions": { "question_4: "answer_options": ["G", "H"] }, "depends_on": { "question_1": "B" } }, + ``` + ## JSON Form Validation against Schema To validate the form JSON against the schema you can run: `rake form_definition:validate["config/forms/2021_2022.json"]` -n.b. You may have to escape square brackets in zsh +n.b. You may have to escape square brackets in zsh `rake form_definition:validate\["config/forms/2021_2022.json"\]` This will validate the given form definition against the schema in `config/forms/schema/generic.json`. @@ -182,6 +192,10 @@ This will validate all forms in directories = ["config/forms", "spec/fixtures/fo - [Technical docs](https://www.rubydoc.info/gems/govuk_design_system_formbuilder/) - [GitHub repository](https://github.com/DFE-Digital/govuk-formbuilder) +### GOV.UK Frontend for Rails + +- [Github repository](https://github.com/DFE-Digital/govuk-components) + ### GOV.UK Frontend - [GitHub repository](https://github.com/alphagov/govuk-frontend) diff --git a/app/admin/case_logs.rb b/app/admin/case_logs.rb index 2a15fbb2a..d34a22623 100644 --- a/app/admin/case_logs.rb +++ b/app/admin/case_logs.rb @@ -2,7 +2,7 @@ ActiveAdmin.register CaseLog do # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters permit_params do - permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 other_hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] + permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armedforces ecstat1 other_hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] permitted end diff --git a/app/constants/db_enums.rb b/app/constants/db_enums.rb index d28393105..7a1c01b19 100644 --- a/app/constants/db_enums.rb +++ b/app/constants/db_enums.rb @@ -699,4 +699,14 @@ module DbEnums "East Renfrewshire" => "S12000011", } end + + def self.armed_forces + { + "A current or former regular in the UK Armed Forces (exc. National Service)" => 1, + "No" => 2, + "Tenant prefers not to say" => 3, + "A current or former reserve in the UK Armed Forces (exc. National Service)" => 4, + "A spouse / civil partner of a UK Armed Forces member who has separated or been bereaved within the last 2 years" => 5, + } + end end diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 1f6936520..4d4ed6db3 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -59,7 +59,7 @@ class CaseLogsController < ApplicationController @case_log.page = params[:case_log][:page] responses_for_page = responses_for_page(@case_log.page) if @case_log.update(responses_for_page) && @case_log.has_no_unresolved_soft_errors? - redirect_path = get_next_page_path(form, @case_log.page, @case_log) + redirect_path = form.next_page_redirect_path(@case_log.page, @case_log) redirect_to(send(redirect_path, @case_log)) else page_info = form.all_pages[@case_log.page] @@ -107,9 +107,13 @@ private day = params["case_log"]["#{question_key}(3i)"] month = params["case_log"]["#{question_key}(2i)"] year = params["case_log"]["#{question_key}(1i)"] - next unless day.present? && month.present? && year.present? + next unless [day, month, year].any?(&:present?) - result[question_key] = Date.new(year.to_i, month.to_i, day.to_i) + result[question_key] = if day.to_i.between?(1, 31) && month.to_i.between?(1, 12) && year.to_i.between?(2000, 2200) + Date.new(year.to_i, month.to_i, day.to_i) + else + Date.new(0, 1, 1) + end end next unless question_params @@ -137,17 +141,4 @@ private params.require(:case_log).permit(CaseLog.editable_fields) end - - def get_next_page_path(form, page, case_log = {}) - content = form.all_pages[page] - - if content.key?("conditional_route_to") - content["conditional_route_to"].each do |route, conditions| - if conditions.keys.all? { |x| case_log[x].present? } && conditions.all? { |k, v| v.include?(case_log[k]) } - return "case_log_#{route}_path" - end - end - end - form.next_page_redirect_path(page) - end end diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb index ba6373b72..fed58b71e 100644 --- a/app/helpers/check_answers_helper.rb +++ b/app/helpers/check_answers_helper.rb @@ -10,19 +10,8 @@ module CheckAnswersHelper end def total_questions(subsection, case_log, form) - total_questions = {} - subsection_keys = form.pages_for_subsection(subsection).keys - page_name = subsection_keys.first - - while page_name.to_s != "check_answers" && subsection_keys.include?(page_name) - questions = form.questions_for_page(page_name) - applicable_questions = form.filter_conditional_questions(questions, case_log) - total_questions = total_questions.merge(applicable_questions) - - page_name = get_next_page_name(form, page_name, case_log) - end - - total_questions + questions = form.questions_for_subsection(subsection) + form.filter_conditional_questions(questions, case_log) end def get_next_page_name(form, page_name, case_log) @@ -37,9 +26,14 @@ module CheckAnswersHelper form.next_page(page_name) end - def create_update_answer_link(case_log_answer, case_log_id, page) - link_name = case_log_answer.blank? ? "Answer" : "Change" - link_to(link_name, "/case_logs/#{case_log_id}/#{page}", class: "govuk-link").html_safe + def create_update_answer_link(question_title, question_info, case_log, form) + page = form.page_for_question(question_title) + link_name = if question_info["type"] == "checkbox" + question_info["answer_options"].keys.any? { |key| case_log[key] == "Yes" } ? "Change" : "Answer" + else + case_log[question_title].blank? ? "Answer" : "Change" + end + link_to(link_name, "/case_logs/#{case_log.id}/#{page}", class: "govuk-link").html_safe end def create_next_missing_question_link(case_log_id, subsection, case_log, form) diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index f546ea56d..720cd5a36 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -26,12 +26,14 @@ class BulkUpload else data_range = FIRST_DATA_ROW..last_row data_range.map do |row_num| - case_log = CaseLog.create + case_log = CaseLog.create! map_row(sheet.row(row_num)).each do |attr_key, attr_val| - begin - case_log.update_attribute(attr_key, attr_val) - rescue ArgumentError + update = case_log.update(attr_key => attr_val) + unless update + # TODO: determine what to do when a bulk upload contains field values that don't pass validations end + rescue ArgumentError + # TODO: determine what we want to do when bulk upload contains totally invalid data for a field. end end end @@ -94,7 +96,7 @@ class BulkUpload ecstat8: row[42], ethnic: row[43], national: row[44], - armed_forces: row[45], + armedforces: row[45], reservist: row[46], preg_occ: row[47], hb: row[48], diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 5b5dc6f40..32bc40739 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -5,6 +5,7 @@ class CaseLogValidator < ActiveModel::Validator include PropertyValidations include FinancialValidations include TenancyValidations + include DateValidations def validate(record) # If we've come from the form UI we only want to validate the specific fields @@ -108,6 +109,7 @@ class CaseLog < ApplicationRecord enum hb: DbEnums.housing_benefit, _suffix: true enum hbrentshortfall: DbEnums.polar_with_unknown, _suffix: true enum property_relet: DbEnums.polar, _suffix: true + enum armedforces: DbEnums.armed_forces, _suffix: true AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze diff --git a/app/models/form.rb b/app/models/form.rb index a2479e20b..34385af99 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -60,37 +60,30 @@ class Form }.first end - def next_page(previous_page) - if all_pages[previous_page].key?("default_next_page") - next_page = all_pages[previous_page]["default_next_page"] - return :check_answers if next_page == "check_answers" + def page_for_question(question) + all_pages.find { |_page_key, page_value| page_value["questions"].key?(question) }.first + end - return next_page - end + def next_page(page, case_log) + subsection = subsection_for_page(page) + page_idx = pages_for_subsection(subsection).keys.index(page) + nxt_page = pages_for_subsection(subsection).keys[page_idx + 1] + return :check_answers if nxt_page.nil? + return nxt_page if page_routed_to?(nxt_page, case_log) - subsection = subsection_for_page(previous_page) - previous_page_idx = pages_for_subsection(subsection).keys.index(previous_page) - pages_for_subsection(subsection).keys[previous_page_idx + 1] || :check_answers + next_page(nxt_page, case_log) end - def next_page_redirect_path(previous_page) - next_page = next_page(previous_page) - if next_page == :check_answers - subsection = subsection_for_page(previous_page) + def next_page_redirect_path(page, case_log) + nxt_page = next_page(page, case_log) + if nxt_page == :check_answers + subsection = subsection_for_page(page) "case_log_#{subsection}_check_answers_path" else - "case_log_#{next_page}_path" + "case_log_#{nxt_page}_path" end end - def previous_page(current_page) - subsection = subsection_for_page(current_page) - current_page_idx = pages_for_subsection(subsection).keys.index(current_page) - return unless current_page_idx.positive? - - pages_for_subsection(subsection).keys[current_page_idx - 1] - end - def all_questions @all_questions ||= all_pages.map { |_page_key, page_value| page_value["questions"] @@ -101,6 +94,10 @@ class Form applicable_questions = questions questions.each do |k, question| + unless page_routed_to?(page_for_question(k), case_log) + applicable_questions = applicable_questions.reject { |z| z == k } + end + question.fetch("conditional_for", []).each do |conditional_question_key, condition| if condition_not_met(case_log, k, question, condition) applicable_questions = applicable_questions.reject { |z| z == conditional_question_key } @@ -110,6 +107,18 @@ class Form applicable_questions end + def page_routed_to?(page, case_log) + return true unless (conditions = page_dependencies(page)) + + conditions.all? do |question, value| + case_log[question].present? && case_log[question] == value + end + end + + def page_dependencies(page) + all_pages[page]["depends_on"] + end + def condition_not_met(case_log, question_key, question, condition) case question["type"] when "numeric" diff --git a/app/validations/date_validations.rb b/app/validations/date_validations.rb new file mode 100644 index 000000000..77f737344 --- /dev/null +++ b/app/validations/date_validations.rb @@ -0,0 +1,21 @@ +module DateValidations + def validate_property_major_repairs(record) + date_valid?("mrcdate", record) + end + + def validate_startdate(record) + date_valid?("startdate", record) + end + + def validate_sale_completion_date(record) + date_valid?("sale_completion_date", record) + end + +private + + def date_valid?(question, record) + if record[question].is_a?(ActiveSupport::TimeWithZone) && record[question].year.zero? + record.errors.add question, "Please enter a valid date" + end + end +end diff --git a/app/validations/household_validations.rb b/app/validations/household_validations.rb index d3536ae8a..5671b1b75 100644 --- a/app/validations/household_validations.rb +++ b/app/validations/household_validations.rb @@ -26,26 +26,26 @@ module HouseholdValidations end def validate_armed_forces_injured(record) - if (record.armed_forces == "Yes - a regular" || record.armed_forces == "Yes - a reserve") && record.reservist.blank? + if (record.armedforces == "A current or former regular in the UK Armed Forces (exc. National Service)" || record.armedforces == "A current or former reserve in the UK Armed Forces (exc. National Service)") && record.reservist.blank? record.errors.add :reservist, "You must answer the armed forces injury question if the tenant has served in the armed forces" end - if (record.armed_forces == "No" || record.armed_forces == "Prefer not to say") && record.reservist.present? + if (record.armedforces == "No" || record.armedforces == "Prefer not to say") && record.reservist.present? record.errors.add :reservist, "You must not answer the armed forces injury question if the tenant has not served in the armed forces or prefer not to say was chosen" end end def validate_armed_forces_active_response(record) - if record.armed_forces == "Yes - a regular" && record.leftreg.blank? + if record.armedforces == "A current or former regular in the UK Armed Forces (exc. National Service)" && record.leftreg.blank? record.errors.add :leftreg, "You must answer the armed forces active question if the tenant has served as a regular in the armed forces" end - if record.armed_forces != "Yes - a regular" && record.leftreg.present? + if record.armedforces != "A current or former regular in the UK Armed Forces (exc. National Service)" && record.leftreg.present? record.errors.add :leftreg, "You must not answer the armed forces active question if the tenant has not served as a regular in the armed forces" end end - def validate_household_pregnancy(record) + def validate_pregnancy(record) if (record.preg_occ == "Yes" || record.preg_occ == "Prefer not to say") && !women_of_child_bearing_age_in_household(record) record.errors.add :preg_occ, "You must answer no as there are no female tenants aged 16-50 in the property" end diff --git a/app/views/case_logs/edit.html.erb b/app/views/case_logs/edit.html.erb index 25668b2ac..94fabb9a9 100644 --- a/app/views/case_logs/edit.html.erb +++ b/app/views/case_logs/edit.html.erb @@ -1,6 +1,6 @@ <%= turbo_frame_tag "case_log_form", target: "_top" do %>
-
+

Tasklist for log <%= @case_log.id %>

diff --git a/app/views/case_logs/index.html.erb b/app/views/case_logs/index.html.erb index 7352c304c..ea3d45436 100644 --- a/app/views/case_logs/index.html.erb +++ b/app/views/case_logs/index.html.erb @@ -2,7 +2,7 @@

Your logs

-
+
<%= link_to "Create new log", case_logs_path, method: :post, class: "govuk-button" %> diff --git a/app/views/form/_check_answers_table.html.erb b/app/views/form/_check_answers_table.html.erb index eaa54075a..6e92c3272 100644 --- a/app/views/form/_check_answers_table.html.erb +++ b/app/views/form/_check_answers_table.html.erb @@ -1,13 +1,11 @@ -
-
-
- <%= question_info["check_answer_label"].to_s.present? ? question_info["check_answer_label"].to_s : question_info["header"].to_s%> -
-
- <%= form.get_answer_label(@case_log, question_title) %> -
-
- <%= create_update_answer_link(@case_log[question_title], @case_log.id, page)%> -
-
-
+
+
+ <%= question_info["check_answer_label"].to_s.present? ? question_info["check_answer_label"].to_s : question_info["header"].to_s%> +
+
+ <%= form.get_answer_label(@case_log, question_title) %> +
+
+ <%= create_update_answer_link(question_title, question_info, @case_log, form) %> +
+
diff --git a/app/views/form/check_answers.html.erb b/app/views/form/check_answers.html.erb index 26b153f8f..74547c016 100644 --- a/app/views/form/check_answers.html.erb +++ b/app/views/form/check_answers.html.erb @@ -1,15 +1,13 @@ <%= turbo_frame_tag "case_log_form", target: "_top" do %>
-
+

Check the answers you gave for <%= subsection.humanize(capitalize: false) %>

<%= display_answered_questions_summary(subsection, @case_log, form) %> - <% form.pages_for_subsection(subsection).each do |page, page_info| %> - <% page_info["questions"].each do |question_title, question_info| %> - <% if total_questions(subsection, @case_log, form).include?(question_title) %> - <%= render partial: 'form/check_answers_table', locals: { question_title: question_title, question_info: question_info, case_log: @case_log, page: page, form: form } %> - <%end %> - <%end %> - <% end %> +
+ <% total_questions(subsection, @case_log, form).each do |question_title, question_info| %> + <%= render partial: 'form/check_answers_table', locals: { question_title: question_title, question_info: question_info, case_log: @case_log, form: form } %> + <% end %> +
<%= form_with model: @case_log, method: "get", builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> <%= f.govuk_submit "Save and continue" %> <% end %> diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb index 238f11439..f29011b99 100644 --- a/app/views/form/page.html.erb +++ b/app/views/form/page.html.erb @@ -4,7 +4,7 @@ <%= turbo_frame_tag "case_log_form", target: "_top" do %>
-
+
<% if page_info["header"].present? %>

<%= page_info["header"] %> diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index ffba80da2..5e0da8f33 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -22,7 +22,7 @@

Email

diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 7ea45b6e4..ad52856b9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -33,25 +33,12 @@ Skip to main content