From 6be722edc4da92148e21369686aac3822b209f27 Mon Sep 17 00:00:00 2001 From: JG Date: Thu, 14 Jul 2022 08:35:22 +0100 Subject: [PATCH] select options in the view --- app/views/schemes/details.html.erb | 6 +++++- app/views/schemes/new.html.erb | 6 +++++- app/views/schemes/support.html.erb | 13 ++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/views/schemes/details.html.erb b/app/views/schemes/details.html.erb index 71e2e5df9..788c36ce6 100644 --- a/app/views/schemes/details.html.erb +++ b/app/views/schemes/details.html.erb @@ -40,8 +40,12 @@ :name, legend: { text: "What is this type of scheme?", size: "m" } %> + <% care_acts_options_hints = { "Yes – part registered as a care home": "A proportion of units are registered as being a care home." } %> + + <% care_acts_options_with_hints = Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: care_acts_options_hints[key.to_sym]) } %> + <%= f.govuk_collection_radio_buttons :registered_under_care_act, - @scheme.care_acts_options_with_hints, + care_acts_options_with_hints, :id, :name, :description, diff --git a/app/views/schemes/new.html.erb b/app/views/schemes/new.html.erb index 9da4d1d95..eca8de2a3 100644 --- a/app/views/schemes/new.html.erb +++ b/app/views/schemes/new.html.erb @@ -44,8 +44,12 @@ :name, legend: { text: "What is this type of scheme?", size: "m" } %> + <% care_acts_options_hints = { "Yes – part registered as a care home": "A proportion of units are registered as being a care home." } %> + + <% care_acts_options_with_hints = Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: care_acts_options_hints[key.to_sym]) } %> + <%= f.govuk_collection_radio_buttons :registered_under_care_act, - @scheme.care_acts_options_with_hints, + care_acts_options_with_hints, :id, :name, :description, diff --git a/app/views/schemes/support.html.erb b/app/views/schemes/support.html.erb index 5ecf2529c..dd2758cfd 100644 --- a/app/views/schemes/support.html.erb +++ b/app/views/schemes/support.html.erb @@ -14,17 +14,24 @@
<%= f.govuk_error_summary %> + <% support_level_options_hints = { "Low level": "Staff visiting once a week, fortnightly or less.", "Medium level": "Staff on site daily or making frequent visits with some out-of-hours cover.", "High level": "Intensive level of staffing provided on a 24-hour basis." } %> + + <% support_level_options_with_hints = Scheme.support_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: support_level_options_hints[key.to_sym]) } %> + <%= f.govuk_collection_radio_buttons :support_type, - @scheme.support_level_options_with_hints, + support_level_options_with_hints, :id, :name, :description, legend: { text: "Level of support given", size: "m" }, bold_labels: false %> - <% intended_stay_selection = Scheme.intended_stays.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> + <% intended_length_of_stay_options_hints = { "Very short stay": "Up to one month.", "Short stay": "Up to one year.", "Medium stay": "More than one year but with an expectation to move on.", "Permanent": "Provides a home for life with no requirement for the tenant to move." } %> + + <% intended_length_of_stay_options_with_hints = Scheme.intended_stays.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: intended_length_of_stay_options_hints[key.to_sym]) } %> + <%= f.govuk_collection_radio_buttons :intended_stay, - @scheme.intended_length_of_stay_options_with_hints, + intended_length_of_stay_options_with_hints, :id, :name, :description,