From 69fb64844a00f007a4c739eb5172da868b7e09f1 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Mon, 3 Jul 2023 16:09:56 +0100 Subject: [PATCH] feat: update validation messages --- app/models/validations/shared_validations.rb | 2 +- config/locales/en.yml | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/models/validations/shared_validations.rb b/app/models/validations/shared_validations.rb index ea2c4b4f9..743954701 100644 --- a/app/models/validations/shared_validations.rb +++ b/app/models/validations/shared_validations.rb @@ -96,7 +96,7 @@ module Validations::SharedValidations when :deactivated then open_deactivation.deactivation_date end - scope = date == :activating_soon ? "#{status}.#{status(scheme_location_validation_page(field))}" : status + scope = %i[activating_soon reactivating_soon].include?(status) ? "#{status}.#{scheme_location_validation_page(field)}" : status { scope:, date: date&.to_formatted_s(:govuk_date), deactivation_date: closest_reactivation&.deactivation_date&.to_formatted_s(:govuk_date) } end diff --git a/config/locales/en.yml b/config/locales/en.yml index eb065aed0..9b8d719f6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -249,17 +249,22 @@ en: location: deactivated: "The location %{postcode} was deactivated on %{date} and was not available on the day you entered." - reactivating_soon: "The location %{postcode} is not available until %{date}. Select another location or edit the tenancy start date" activating_soon: date_page: "The location %{postcode} is not available until %{date}. Enter a tenancy start date after %{date}" location_page: "The location %{postcode} is not available until %{date}. Select another location or edit the tenancy start date" scheme_page: "This scheme's only location %{postcode} is not available until %{date}. Select another scheme or edit the tenancy start date" + reactivating_soon: + date_page: "The location %{postcode} is not available until %{date}. Enter a tenancy start date after %{date}" + location_page: "The location %{postcode} is not available until %{date}. Select another location or edit the tenancy start date" + scheme_page: "This scheme's only location %{postcode} is not available until %{date}. Select another scheme or edit the tenancy start date" scheme: - deactivated: "%{name} was deactivated on %{date} and was not available on the day you entered" - reactivating_soon: "The scheme %{name} is not available until %{date}. Select another scheme or edit the tenancy start date" + deactivated: "The scheme %{name} was deactivated on %{date} and was not available on the day you entered" activating_soon: - date_page: "%{name} is not available until %{date}. Enter a tenancy start date after %{date}" - scheme_page: "%{name} is not available until %{date}. Select another scheme or edit the tenancy start date" + date_page: "The scheme %{name} is not available until %{date}. Enter a tenancy start date after %{date}" + scheme_page: "The scheme %{name} is not available until %{date}. Select another scheme or edit the tenancy start date" + reactivating_soon: + date_page: "The scheme %{name} is not available until %{date}. Enter a tenancy start date after %{date}" + scheme_page: "The scheme %{name} is not available until %{date}. Select another scheme or edit the tenancy start date" owning_organisation: invalid: "Please select the owning organisation or managing organisation that you belong to" data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the owning organisation."