From 271735deb5669dd70b69738c08cb6d4c219c411d Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 7 Aug 2024 09:09:30 +0100 Subject: [PATCH] Refactor discounted ownership guidance --- ...cial_calculations_discounted_ownership.html.erb | 14 +++++--------- ...inancial_calculations_shared_ownership.html.erb | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/app/views/form/guidance/_financial_calculations_discounted_ownership.html.erb b/app/views/form/guidance/_financial_calculations_discounted_ownership.html.erb index 37a646983..39d3ec4d4 100644 --- a/app/views/form/guidance/_financial_calculations_discounted_ownership.html.erb +++ b/app/views/form/guidance/_financial_calculations_discounted_ownership.html.erb @@ -1,14 +1,10 @@ -<% grant_page = log.form.get_question("grant", log).page %> -<% mortgage_page = log.form.get_question("mortgage", log).page %> -<% discount_page = log.form.get_question("discount", log).page %> -<% deposit_page = log.form.get_question("deposit", log).page %> <%= govuk_details(summary_text: "How the financial values are calculated") do %>

- The mortgage amount <%= "(#{govuk_link_to 'Q105', send("#{log.class.name.underscore}_#{mortgage_page.id}_path", log)})".html_safe if mortgage_page.routed_to?(log, current_user) %> - cash deposit <%= "(#{govuk_link_to 'Q109', send("#{log.class.name.underscore}_#{deposit_page.id}_path", log)})".html_safe if deposit_page.routed_to?(log, current_user) %> - and grant <%= "(#{govuk_link_to 'Q102', send("#{log.class.name.underscore}_#{grant_page.id}_path", log)})".html_safe if grant_page.routed_to?(log, current_user) %> + The mortgage amount <%= question_link("mortgage", log, current_user) %> + cash deposit <%= question_link("deposit", log, current_user) %> + and grant <%= question_link("grant", log, current_user) %> added together must equal - the purchase price (<%= govuk_link_to "Q101", send("#{log.class.name.underscore}_#{log.form.get_question('value', log).page.id}_path", log) %>) - multiplied by the discount stake <%= "(#{govuk_link_to '103', send("#{log.class.name.underscore}_#{discount_page.id}_path", log)})".html_safe if discount_page.routed_to?(log, current_user) %> + the purchase price <%= question_link("value", log, current_user) %> + multiplied by the discount stake <%= question_link("discount", log, current_user) %>

<% end %> diff --git a/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb b/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb index 617b43acd..1fbc693d7 100644 --- a/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb +++ b/app/views/form/guidance/_financial_calculations_shared_ownership.html.erb @@ -5,8 +5,8 @@ and cash discount <%= question_link("cashdis", log, current_user) %> added together must equal the purchase price <%= question_link("value", log, current_user) %> - <% stairbought_page = log.form.get_question('stairbought', log).page %> - <% equity_page = log.form.get_question('equity', log).page %> + <% stairbought_page = log.form.get_question("stairbought", log).page %> + <% equity_page = log.form.get_question("equity", log).page %> <% if stairbought_page.routed_to?(log, current_user) %> multiplied by the percentage bought <%= question_link("stairbought", log, current_user) %> <% else %>