From cdae8964c6a338ebd42c9f92741d942df65e0328 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 27 Jan 2023 16:56:56 +0000 Subject: [PATCH] feat: improve currency interruption screen display --- app/helpers/interruption_screen_helper.rb | 8 ++++++-- .../pages/about_price_shared_ownership_value_check.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/helpers/interruption_screen_helper.rb b/app/helpers/interruption_screen_helper.rb index d4034c01e..7cdc2a9dc 100644 --- a/app/helpers/interruption_screen_helper.rb +++ b/app/helpers/interruption_screen_helper.rb @@ -7,10 +7,12 @@ module InterruptionScreenHelper value = if argument["label"] pre_casing_value = lettings_log.form.get_question(argument["key"], lettings_log).answer_label(lettings_log) pre_casing_value.downcase + elsif argument["currency"] + ["£", ActionController::Base.helpers.number_to_currency(lettings_log.public_send(argument["key"]), delimiter: ",", format: "%n")].join("") else lettings_log.public_send(argument["key"]) end - translation_params[argument["i18n_template"].to_sym] = argument["prefix"] == "£" ? "£#{ActionController::Base.helpers.number_to_currency(value, delimiter: ',', format: '%n')}" : value + translation_params[argument["i18n_template"].to_sym] = value end begin @@ -30,10 +32,12 @@ module InterruptionScreenHelper arguments.each do |argument| value = if argument["label"] lettings_log.form.get_question(argument["key"], lettings_log).answer_label(lettings_log).downcase + elsif argument["currency"] + ["£", ActionController::Base.helpers.number_to_currency(lettings_log.public_send(argument["key"]), delimiter: ",", format: "%n")].join("") else lettings_log.public_send(argument["key"]) end - translation_params[argument["i18n_template"].to_sym] = argument["prefix"] == "£" ? "£#{ActionController::Base.helpers.number_to_currency(value, delimiter: ',', format: '%n')}" : value + translation_params[argument["i18n_template"].to_sym] = value end I18n.t(title_text["translation"], **translation_params).to_s end diff --git a/app/models/form/sales/pages/about_price_shared_ownership_value_check.rb b/app/models/form/sales/pages/about_price_shared_ownership_value_check.rb index 90862a5b5..ec7e8da15 100644 --- a/app/models/form/sales/pages/about_price_shared_ownership_value_check.rb +++ b/app/models/form/sales/pages/about_price_shared_ownership_value_check.rb @@ -24,7 +24,7 @@ class Form::Sales::Pages::AboutPriceSharedOwnershipValueCheck < ::Form::Page "key" => "purchase_price_soft_min_or_soft_max", "label" => false, "i18n_template" => "soft_min_or_soft_max", - "prefix" => "£", + "currency" => true, }, { "key" => "purchase_price_min_or_max_text",