diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index a1c053efc..6ff7d16f4 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -11,7 +11,7 @@ class FormController < ApplicationController mandatory_questions_with_no_response = mandatory_questions_with_no_response(responses_for_page) if mandatory_questions_with_no_response.empty? && @log.update(responses_for_page.merge(updated_by: current_user)) - flash[:notice] = "You have successfully updated #{@page.questions.map(&:check_answer_label).join(', ')}" if interruption_screen_referrer.present? + flash[:notice] = "You have successfully updated #{@page.questions.map(&:check_answer_label).join(', ').downcase}" if interruption_screen_referrer.present? redirect_to(successful_redirect_path) else mandatory_questions_with_no_response.map do |question| @@ -47,7 +47,7 @@ class FormController < ApplicationController def show_page if request.params["referrer"] == "interruption_screen" - @interruption_page_id = request.headers["HTTP_REFERER"].split("/")[-1].underscore + @interruption_page_id = request.headers["HTTP_REFERER"].split("/")[-1].split("?")[0].underscore end if @log diff --git a/app/helpers/interruption_screen_helper.rb b/app/helpers/interruption_screen_helper.rb index de29ccfc6..6247754da 100644 --- a/app/helpers/interruption_screen_helper.rb +++ b/app/helpers/interruption_screen_helper.rb @@ -30,7 +30,7 @@ module InterruptionScreenHelper end def soft_validation_affected_questions(question, log) - question.page.affected_question_ids.map { |question_id| log.form.get_question(question_id, log) } + question.page.affected_question_ids.map { |question_id| log.form.get_question(question_id, log) }.compact end def interruption_action_href(log, page_id) diff --git a/app/models/form/lettings/pages/net_income_value_check.rb b/app/models/form/lettings/pages/net_income_value_check.rb index 5ceddda69..50c0becae 100644 --- a/app/models/form/lettings/pages/net_income_value_check.rb +++ b/app/models/form/lettings/pages/net_income_value_check.rb @@ -8,8 +8,8 @@ class Form::Lettings::Pages::NetIncomeValueCheck < ::Form::Page "translation" => "soft_validations.net_income.hint_text", "arguments" => [ { - "key" => "field_formatted_as_currency", - "arguments_for_key" => "ecstat1", + "key" => "ecstat1", + "label" => true, "i18n_template" => "ecstat1", }, { diff --git a/app/models/form/sales/pages/deposit_value_check.rb b/app/models/form/sales/pages/deposit_value_check.rb index f7fc8bae1..a4d5e8412 100644 --- a/app/models/form/sales/pages/deposit_value_check.rb +++ b/app/models/form/sales/pages/deposit_value_check.rb @@ -7,6 +7,9 @@ class Form::Sales::Pages::DepositValueCheck < ::Form::Page }, ] @informative_text = {} + @title_text = { + "translation" => "soft_validations.deposit.title_text", + } end def questions diff --git a/app/models/form/sales/pages/grant_value_check.rb b/app/models/form/sales/pages/grant_value_check.rb index b0cdfa88b..a996872be 100644 --- a/app/models/form/sales/pages/grant_value_check.rb +++ b/app/models/form/sales/pages/grant_value_check.rb @@ -7,6 +7,7 @@ class Form::Sales::Pages::GrantValueCheck < ::Form::Page "grant_outside_common_range?" => true, }, ] + @title_text = { "translation" => "soft_validations.grant.title_text" } @informative_text = {} end diff --git a/app/models/form/sales/pages/household_wheelchair_check.rb b/app/models/form/sales/pages/household_wheelchair_check.rb index c11f4712b..a4bb95f33 100644 --- a/app/models/form/sales/pages/household_wheelchair_check.rb +++ b/app/models/form/sales/pages/household_wheelchair_check.rb @@ -7,6 +7,7 @@ class Form::Sales::Pages::HouseholdWheelchairCheck < ::Form::Page }, ] @informative_text = {} + @title_text = { "translation" => "soft_validations.wheelchair.title_text" } end def questions diff --git a/app/models/form/sales/pages/mortgage_value_check.rb b/app/models/form/sales/pages/mortgage_value_check.rb index 6d53c841b..cbb9d8ccc 100644 --- a/app/models/form/sales/pages/mortgage_value_check.rb +++ b/app/models/form/sales/pages/mortgage_value_check.rb @@ -4,6 +4,7 @@ class Form::Sales::Pages::MortgageValueCheck < ::Form::Page @depends_on = depends_on @informative_text = {} @person_index = person_index + @title_text = { "translation" => "soft_validations.mortgage.title_text" } end def questions diff --git a/app/models/form/sales/pages/savings_value_check.rb b/app/models/form/sales/pages/savings_value_check.rb index 2f0eab506..c31855eb5 100644 --- a/app/models/form/sales/pages/savings_value_check.rb +++ b/app/models/form/sales/pages/savings_value_check.rb @@ -6,6 +6,9 @@ class Form::Sales::Pages::SavingsValueCheck < ::Form::Page "savings_over_soft_max?" => true, }, ] + @title_text = { + "translation" => "soft_validations.savings.title_text", + } @informative_text = {} end diff --git a/app/views/form/_interruption_screen_question.html.erb b/app/views/form/_interruption_screen_question.html.erb index 7e3625b7e..338cfb6dc 100644 --- a/app/views/form/_interruption_screen_question.html.erb +++ b/app/views/form/_interruption_screen_question.html.erb @@ -4,7 +4,6 @@ ) do %>

<%= display_title_text(title_text, lettings_log) %>

<%= display_informative_text(informative_text, lettings_log) %>

-

<%= question.header %>

<%= question.hint_text&.html_safe %>

<% end %> <% end %> diff --git a/config/forms/2022_2023.json b/config/forms/2022_2023.json index 7f6c88e4f..5e598b32a 100644 --- a/config/forms/2022_2023.json +++ b/config/forms/2022_2023.json @@ -8324,8 +8324,8 @@ } ] }, - "header": "This rent is lower than expected for this property type, in this area. Check:", - "hint_text": "

Are you sure this is correct?

", + "header": "Are you sure this is correct?", + "hint_text": "This rent is lower than expected for this property type, in this area. Check:", "type": "interruption_screen", "answer_options": { "0": { @@ -8369,8 +8369,8 @@ } ] }, - "header": "This rent is higher than expected for this property type, in this area. Check:", - "hint_text": "

Are you sure this is correct?

", + "header": "Are you sure this is correct?", + "hint_text": "This rent is higher than expected for this property type, in this area. Check:", "type": "interruption_screen", "answer_options": { "0": { diff --git a/config/locales/en.yml b/config/locales/en.yml index a798a258f..6ff50c006 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -569,6 +569,16 @@ en: title_text: "You told us that buyer 2 will not live in the property. For %{ownership_scheme} types, the buyer usually lives in the property." percentage_discount_value: title_text: "You told us that the percentage discount was %{discount}. This seems high for this type of property." + savings: + title_text: "Are you sure the savings are higher than £100,000?" + deposit: + title_text: "Are you sure that the deposit is this much higher than the buyer's savings?" + grant: + title_text: "Are you sure? Grants are usually £9,000 - £16,000" + wheelchair: + title_text: "Are you sure? You said previously that somebody in household uses a wheelchair" + mortgage: + title_text: "Are you sure that the mortgage is more than 5 times the income used for the mortgage application?" devise: two_factor_authentication: diff --git a/spec/models/form/lettings/pages/net_income_value_check_spec.rb b/spec/models/form/lettings/pages/net_income_value_check_spec.rb index c43eb3381..08a9c731c 100644 --- a/spec/models/form/lettings/pages/net_income_value_check_spec.rb +++ b/spec/models/form/lettings/pages/net_income_value_check_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Form::Lettings::Pages::NetIncomeValueCheck, type: :model do it "has the correct informative_text" do expect(page.informative_text).to eq({ - "arguments" => [{ "arguments_for_key" => "ecstat1", "i18n_template" => "ecstat1", "key" => "field_formatted_as_currency" }, { "arguments_for_key" => "earnings", "i18n_template" => "earnings", "key" => "field_formatted_as_currency" }], + "arguments" => [{ "label" => true, "i18n_template" => "ecstat1", "key" => "ecstat1" }, { "arguments_for_key" => "earnings", "i18n_template" => "earnings", "key" => "field_formatted_as_currency" }], "translation" => "soft_validations.net_income.hint_text", }) end