From 89c30f363dde1efae4a4f8cb28e3223255dee882 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:33:05 +0100 Subject: [PATCH] CLDC-2628 Update schemes guidance page (#1976) * Refactor guidance to allow both top and bottom guidance at the same time * Update guidance content, add scheme changes page * update test * remove full stop * Update content, add back button --- app/controllers/organisations_controller.rb | 4 +++ app/controllers/schemes_controller.rb | 6 +++- app/models/form/lettings/pages/scheme.rb | 1 + .../form/lettings/questions/declaration.rb | 2 +- .../form/lettings/questions/earnings.rb | 3 +- .../lettings/questions/net_income_known.rb | 3 +- .../form/lettings/questions/rent_type.rb | 3 +- .../form/lettings/questions/scheme_id.rb | 6 ++-- .../form/lettings/questions/voiddate.rb | 3 +- app/models/form/question.rb | 15 +++------ .../questions/discounted_ownership_type.rb | 3 +- .../form/sales/questions/mortgage_lender.rb | 3 +- .../questions/outright_ownership_type.rb | 3 +- .../form/sales/questions/privacy_notice.rb | 2 +- .../sales/questions/shared_ownership_type.rb | 3 +- app/policies/scheme_policy.rb | 4 +++ app/views/form/_checkbox_question.html.erb | 4 +-- app/views/form/_date_question.html.erb | 4 +-- .../form/_numeric_output_question.html.erb | 4 +-- app/views/form/_numeric_question.html.erb | 4 +-- app/views/form/_radio_question.html.erb | 4 +-- app/views/form/_select_question.html.erb | 5 +-- app/views/form/_text_question.html.erb | 4 +-- app/views/form/_textarea_question.html.erb | 4 +-- app/views/form/guidance/_finding_scheme.erb | 5 +++ .../form/guidance/_scheme_selection.html.erb | 4 +-- app/views/schemes/changes.html.erb | 33 +++++++++++++++++++ config/forms/2021_2022.json | 6 ++-- config/forms/2022_2023.json | 9 +++-- config/routes.rb | 1 + spec/fixtures/forms/2021_2022.json | 2 +- .../models/form/lettings/pages/scheme_spec.rb | 2 +- .../form/lettings/questions/rent_type_spec.rb | 2 +- .../form/lettings/questions/scheme_id_spec.rb | 2 +- .../form/lettings/questions/voiddate_spec.rb | 4 +-- .../discounted_ownership_type_spec.rb | 8 ++--- .../sales/questions/mortgage_lender_spec.rb | 10 ++++-- .../questions/outright_ownership_type_spec.rb | 16 ++++++--- .../questions/shared_ownership_type_spec.rb | 8 ++--- 39 files changed, 130 insertions(+), 79 deletions(-) create mode 100644 app/views/form/guidance/_finding_scheme.erb create mode 100644 app/views/schemes/changes.html.erb diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index ff64c6136..41213ba9c 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -200,6 +200,10 @@ class OrganisationsController < ApplicationController redirect_to details_organisation_path(@organisation) end + def changes + render "schemes/changes" + end + private def filter_type diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb index 8cf824af9..427931b3e 100644 --- a/app/controllers/schemes_controller.rb +++ b/app/controllers/schemes_controller.rb @@ -3,7 +3,7 @@ class SchemesController < ApplicationController include Modules::SearchFilter before_action :authenticate_user! - before_action :find_resource, except: %i[index create new] + before_action :find_resource, except: %i[index create new changes] before_action :redirect_if_scheme_confirmed, only: %i[primary_client_group confirm_secondary_client_group secondary_client_group support details] before_action :authorize_user before_action :session_filters, if: :current_user, only: %i[index] @@ -201,6 +201,10 @@ class SchemesController < ApplicationController render "schemes/edit_name" end + def changes + render "schemes/changes" + end + private def authorize_user diff --git a/app/models/form/lettings/pages/scheme.rb b/app/models/form/lettings/pages/scheme.rb index 9ac87a756..06bb6eb9c 100644 --- a/app/models/form/lettings/pages/scheme.rb +++ b/app/models/form/lettings/pages/scheme.rb @@ -6,6 +6,7 @@ class Form::Lettings::Pages::Scheme < ::Form::Page "needstype" => 2, }, ] + @header = "Scheme" @next_unresolved_page_id = "location" end diff --git a/app/models/form/lettings/questions/declaration.rb b/app/models/form/lettings/questions/declaration.rb index 742545b96..03fc72f4a 100644 --- a/app/models/form/lettings/questions/declaration.rb +++ b/app/models/form/lettings/questions/declaration.rb @@ -6,7 +6,7 @@ class Form::Lettings::Questions::Declaration < ::Form::Question @header = "Declaration" @type = "checkbox" @check_answers_card_number = 0 - @guidance_partial = "privacy_notice_tenant" + @top_guidance_partial = "privacy_notice_tenant" @answer_options = ANSWER_OPTIONS @question_number = 30 end diff --git a/app/models/form/lettings/questions/earnings.rb b/app/models/form/lettings/questions/earnings.rb index 4169547c1..84d9ff9c5 100644 --- a/app/models/form/lettings/questions/earnings.rb +++ b/app/models/form/lettings/questions/earnings.rb @@ -8,8 +8,7 @@ class Form::Lettings::Questions::Earnings < ::Form::Question @width = 5 @check_answers_card_number = 0 @min = 0 - @guidance_partial = "what_counts_as_income" - @guidance_position = GuidancePosition::TOP + @top_guidance_partial = "what_counts_as_income" @hint_text = "" @step = 0.01 @prefix = "£" diff --git a/app/models/form/lettings/questions/net_income_known.rb b/app/models/form/lettings/questions/net_income_known.rb index 4c232a85d..d3008f44f 100644 --- a/app/models/form/lettings/questions/net_income_known.rb +++ b/app/models/form/lettings/questions/net_income_known.rb @@ -6,8 +6,7 @@ class Form::Lettings::Questions::NetIncomeKnown < ::Form::Question @header = "Do you know the household’s combined income after tax?" @type = "radio" @check_answers_card_number = 0 - @guidance_partial = "what_counts_as_income" - @guidance_position = GuidancePosition::TOP + @top_guidance_partial = "what_counts_as_income" @hint_text = "" @answer_options = ANSWER_OPTIONS @question_number = 86 diff --git a/app/models/form/lettings/questions/rent_type.rb b/app/models/form/lettings/questions/rent_type.rb index b902539a3..4ff1a0d32 100644 --- a/app/models/form/lettings/questions/rent_type.rb +++ b/app/models/form/lettings/questions/rent_type.rb @@ -5,8 +5,7 @@ class Form::Lettings::Questions::RentType < ::Form::Question @check_answer_label = "Rent type" @header = "What is the rent type?" @type = "radio" - @guidance_partial = "rent_type_definitions" - @guidance_position = GuidancePosition::TOP + @top_guidance_partial = "rent_type_definitions" @answer_options = ANSWER_OPTIONS @conditional_for = { "irproduct_other" => [5] } @question_number = 6 diff --git a/app/models/form/lettings/questions/scheme_id.rb b/app/models/form/lettings/questions/scheme_id.rb index 5d140b21b..8d906f134 100644 --- a/app/models/form/lettings/questions/scheme_id.rb +++ b/app/models/form/lettings/questions/scheme_id.rb @@ -3,11 +3,11 @@ class Form::Lettings::Questions::SchemeId < ::Form::Question super("scheme_id", hsh, page) @check_answer_label = "Scheme name" @header = "What scheme is this log for?" - @hint_text = "Enter scheme name or postcode" + @hint_text = "Enter postcode or scheme name" @type = "select" @answer_options = answer_options - @guidance_position = GuidancePosition::BOTTOM - @guidance_partial = "scheme_selection" + @top_guidance_partial = "finding_scheme" + @bottom_guidance_partial = "scheme_selection" @question_number = 9 @inferred_answers = { "location.name": { diff --git a/app/models/form/lettings/questions/voiddate.rb b/app/models/form/lettings/questions/voiddate.rb index 0431b9adb..d20219b0b 100644 --- a/app/models/form/lettings/questions/voiddate.rb +++ b/app/models/form/lettings/questions/voiddate.rb @@ -7,7 +7,6 @@ class Form::Lettings::Questions::Voiddate < ::Form::Question @type = "date" @check_answers_card_number = 0 @question_number = 23 - @guidance_partial = "void_date" - @guidance_position = GuidancePosition::BOTTOM + @bottom_guidance_partial = "void_date" end end diff --git a/app/models/form/question.rb b/app/models/form/question.rb index 9f0a8aac9..eac75dc5c 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -3,22 +3,17 @@ class Form::Question :type, :min, :max, :step, :width, :fields_to_add, :result_field, :conditional_for, :readonly, :answer_options, :page, :check_answer_label, :inferred_answers, :hidden_in_check_answers, :inferred_check_answers_value, - :guidance_partial, :prefix, :suffix, :requires_js, :fields_added, :derived, + :top_guidance_partial, :bottom_guidance_partial, :prefix, :suffix, :requires_js, :fields_added, :derived, :check_answers_card_number, :unresolved_hint_text, :question_number, :hide_question_number_on_page, :plain_label, :error_label - module GuidancePosition - TOP = 1 - BOTTOM = 2 - end - def initialize(id, hsh, page) @id = id @page = page if hsh @check_answer_label = hsh["check_answer_label"] @header = hsh["header"] - @guidance_partial = hsh["guidance_partial"] - @guidance_position = hsh["guidance_position"] || GuidancePosition::TOP + @top_guidance_partial = hsh["top_guidance_partial"] + @bottom_guidance_partial = hsh["bottom_guidance_partial"] @hint_text = hsh["hint_text"] @type = hsh["type"] @min = hsh["min"] @@ -232,11 +227,11 @@ class Form::Question end def top_guidance? - @guidance_partial && @guidance_position == GuidancePosition::TOP + @top_guidance_partial.present? end def bottom_guidance? - @guidance_partial && @guidance_position == GuidancePosition::BOTTOM + @bottom_guidance_partial.present? end def is_derived_or_has_inferred_check_answers_value?(log) diff --git a/app/models/form/sales/questions/discounted_ownership_type.rb b/app/models/form/sales/questions/discounted_ownership_type.rb index aeb00fac1..be4d3c47b 100644 --- a/app/models/form/sales/questions/discounted_ownership_type.rb +++ b/app/models/form/sales/questions/discounted_ownership_type.rb @@ -5,8 +5,7 @@ class Form::Sales::Questions::DiscountedOwnershipType < ::Form::Question @check_answer_label = "Type of discounted ownership sale" @header = "What is the type of discounted ownership sale?" @type = "radio" - @guidance_partial = guidance_partial - @guidance_position = GuidancePosition::TOP + @top_guidance_partial = guidance_partial @answer_options = ANSWER_OPTIONS @question_number = 5 end diff --git a/app/models/form/sales/questions/mortgage_lender.rb b/app/models/form/sales/questions/mortgage_lender.rb index ad584aab5..e2f57306e 100644 --- a/app/models/form/sales/questions/mortgage_lender.rb +++ b/app/models/form/sales/questions/mortgage_lender.rb @@ -8,8 +8,7 @@ class Form::Sales::Questions::MortgageLender < ::Form::Question @hint_text = "" @page = page @answer_options = ANSWER_OPTIONS - @guidance_position = GuidancePosition::BOTTOM - @guidance_partial = "mortgage_lender" + @bottom_guidance_partial = "mortgage_lender" @ownershipsch = ownershipsch @question_number = question_number end diff --git a/app/models/form/sales/questions/outright_ownership_type.rb b/app/models/form/sales/questions/outright_ownership_type.rb index 71fa86e65..eb587d396 100644 --- a/app/models/form/sales/questions/outright_ownership_type.rb +++ b/app/models/form/sales/questions/outright_ownership_type.rb @@ -5,8 +5,7 @@ class Form::Sales::Questions::OutrightOwnershipType < ::Form::Question @check_answer_label = "Type of outright sale" @header = "What is the type of outright sale?" @type = "radio" - @guidance_partial = guidance_partial - @guidance_position = GuidancePosition::TOP + @top_guidance_partial = guidance_partial @answer_options = ANSWER_OPTIONS @conditional_for = { "othtype" => [12], diff --git a/app/models/form/sales/questions/privacy_notice.rb b/app/models/form/sales/questions/privacy_notice.rb index c08e4be6a..d440e414b 100644 --- a/app/models/form/sales/questions/privacy_notice.rb +++ b/app/models/form/sales/questions/privacy_notice.rb @@ -6,7 +6,7 @@ class Form::Sales::Questions::PrivacyNotice < ::Form::Question @header = "Declaration" @type = "checkbox" @answer_options = ANSWER_OPTIONS - @guidance_partial = "privacy_notice_buyer" + @top_guidance_partial = "privacy_notice_buyer" @question_number = 19 end diff --git a/app/models/form/sales/questions/shared_ownership_type.rb b/app/models/form/sales/questions/shared_ownership_type.rb index 053af2e1a..658aa3139 100644 --- a/app/models/form/sales/questions/shared_ownership_type.rb +++ b/app/models/form/sales/questions/shared_ownership_type.rb @@ -5,8 +5,7 @@ class Form::Sales::Questions::SharedOwnershipType < ::Form::Question @check_answer_label = "Type of shared ownership sale" @header = "What is the type of shared ownership sale?" @hint_text = "A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion" - @guidance_partial = guidance_partial - @guidance_position = GuidancePosition::TOP + @top_guidance_partial = guidance_partial @type = "radio" @answer_options = answer_options @question_number = 4 diff --git a/app/policies/scheme_policy.rb b/app/policies/scheme_policy.rb index 30aa1543c..f2710eb06 100644 --- a/app/policies/scheme_policy.rb +++ b/app/policies/scheme_policy.rb @@ -30,6 +30,10 @@ class SchemePolicy user.data_coordinator? && scheme_owned_by_user_org_or_stock_owner end + def changes? + true + end + %w[ show? check_answers? diff --git a/app/views/form/_checkbox_question.html.erb b/app/views/form/_checkbox_question.html.erb index 2a9c33941..2e8585e15 100644 --- a/app/views/form/_checkbox_question.html.erb +++ b/app/views/form/_checkbox_question.html.erb @@ -1,4 +1,4 @@ -<%= render partial: "form/guidance/#{question.guidance_partial}" if question.top_guidance? %> +<%= render partial: "form/guidance/#{question.top_guidance_partial}" if question.top_guidance? %> <%= f.govuk_check_boxes_fieldset question.id.to_sym, caption: caption(caption_text, page_header, conditional), @@ -21,4 +21,4 @@ <% end %> <% end %> -<%= render partial: "form/guidance/#{question.guidance_partial}" if question.bottom_guidance? %> +<%= render partial: "form/guidance/#{question.bottom_guidance_partial}" if question.bottom_guidance? %> diff --git a/app/views/form/_date_question.html.erb b/app/views/form/_date_question.html.erb index 167e02a31..c84d60d0e 100644 --- a/app/views/form/_date_question.html.erb +++ b/app/views/form/_date_question.html.erb @@ -1,4 +1,4 @@ -<%= render partial: "form/guidance/#{question.guidance_partial}" if question.top_guidance? %> +<%= render partial: "form/guidance/#{question.top_guidance_partial}" if question.top_guidance? %> <%= f.govuk_date_field question.id.to_sym, caption: caption(caption_text, page_header, conditional), @@ -9,4 +9,4 @@ <%= govuk_inset_text(text: question.unresolved_hint_text) if question.unresolved_hint_text.present? && @log.unresolved %> <% end %> -<%= render partial: "form/guidance/#{question.guidance_partial}" if question.bottom_guidance? %> +<%= render partial: "form/guidance/#{question.bottom_guidance_partial}" if question.bottom_guidance? %> diff --git a/app/views/form/_numeric_output_question.html.erb b/app/views/form/_numeric_output_question.html.erb index 7d681f7ea..66b5e5dab 100644 --- a/app/views/form/_numeric_output_question.html.erb +++ b/app/views/form/_numeric_output_question.html.erb @@ -1,4 +1,4 @@ -<%= render partial: "form/guidance/#{question.guidance_partial}" if question.top_guidance? %> +<%= render partial: "form/guidance/#{question.top_guidance_partial}" if question.top_guidance? %>
If your organisation’s schemes were migrated from old CORE, they may have new names and codes. Search by postcode to find your scheme.
+<%= govuk_link_to("View your organisation’s schemes", schemes_path) %>
+<%= govuk_link_to("Read more about how schemes have changed", scheme_changes_path) %>
+<% end %> diff --git a/app/views/form/guidance/_scheme_selection.html.erb b/app/views/form/guidance/_scheme_selection.html.erb index c48644077..c13edb05b 100644 --- a/app/views/form/guidance/_scheme_selection.html.erb +++ b/app/views/form/guidance/_scheme_selection.html.erb @@ -1,5 +1,5 @@ <% if current_user.data_provider? %> -If you can’t find the supported housing service you’re looking for or not sure which to choose, contact a data coordinator at <%= current_user.organisation.name %>.
+If you’re not sure which scheme to choose, ask a data coordinator. Find your data coordinators on the <%= govuk_link_to("users page", users_path) %>.
<% elsif current_user.data_coordinator? %> -or <%= govuk_link_to "create a new supported housing service", new_scheme_path %>
+<%= govuk_link_to "Create a new supported housing scheme", new_scheme_path %>
<% end %> diff --git a/app/views/schemes/changes.html.erb b/app/views/schemes/changes.html.erb new file mode 100644 index 000000000..850cc63ce --- /dev/null +++ b/app/views/schemes/changes.html.erb @@ -0,0 +1,33 @@ +<% content_for :before_content do %> + <%= govuk_back_link(href: :back) %> +<% end %> + +A supported housing scheme (also known as a ‘supported housing service’) provides shared or self-contained housing for a particular client group, for example younger or vulnerable people.
+ +A location is a postcode where supported housing is provided under a scheme. A scheme can have multiple locations, and a location can have multiple units at the same postcode.
+ +We have restructured the way we group supported housing scheme data.
+On old CORE, a scheme’s data was split into management group and scheme. On new CORE, the data is split into scheme and location.
+These are the main changes:
+This new structure means data coordinators only needs to fill in support details once.
+If your organisation has migrated from old CORE to new CORE, your existing schemes are on the <%= govuk_link_to("schemes page", schemes_path) %>, with the same details.
+Your migrated schemes have been restructured to match the new structure described above. Schemes with the same support details have been combined to prevent duplicates.
+All migrated schemes have new names and codes. The new scheme names were created automatically based on their support details. Some of these auto-generated names are quite long, so we recommend data coordinators rename them.
+If you upload logs in bulk, you can use either the new or old scheme codes in your template.
+You should be able to recognise a scheme migrated from old CORE by viewing its details or locations. Try searching for it by postcode.
+If you still can’t find a scheme that was migrated from old CORE, either create a new one if you know the details, or <%= govuk_link_to("contact the helpdesk", "https://dluhcdigital.atlassian.net/servicedesk/customer/portal/6/group/11", rel: "noreferrer noopener", target: "_blank") %> to report the problem. Only data coordinators can create and edit schemes.
+