From 0e029d8b0a50da4d63b475acebdc99e0704d277e Mon Sep 17 00:00:00 2001 From: Ted-U <92022120+Ted-U@users.noreply.github.com> Date: Wed, 3 Aug 2022 13:33:38 +0100 Subject: [PATCH] CLDC-1400-error-summary-above-heading (#806) * moved error summaries above headings for locations/schemes * fix indentation --- app/views/locations/edit.html.erb | 4 ++-- app/views/locations/edit_name.html.erb | 4 ++-- app/views/locations/new.html.erb | 4 ++-- app/views/schemes/check_answers.html.erb | 7 ++++--- app/views/schemes/details.html.erb | 4 ++-- app/views/schemes/edit_name.html.erb | 4 ++-- app/views/schemes/new.html.erb | 18 +++++++++--------- .../schemes/primary_client_group.html.erb | 4 ++-- .../schemes/secondary_client_group.html.erb | 4 ++-- app/views/schemes/support.html.erb | 4 ++-- 10 files changed, 29 insertions(+), 28 deletions(-) diff --git a/app/views/locations/edit.html.erb b/app/views/locations/edit.html.erb index 176b2a9e1..6fe2496b2 100644 --- a/app/views/locations/edit.html.erb +++ b/app/views/locations/edit.html.erb @@ -7,13 +7,13 @@ ) %> <% end %> -<%= render partial: "organisations/headings", locals: { main: "Add a location to this scheme", sub: @scheme.service_name } %> - <%= form_for(@location, method: :patch, url: location_path) do |f| %>
<%= f.govuk_error_summary %> + <%= render partial: "organisations/headings", locals: { main: "Add a location to this scheme", sub: @scheme.service_name } %> + <%= f.govuk_text_field :postcode, label: { size: "m" }, hint: { text: I18n.t("hints.location.postcode") }, diff --git a/app/views/locations/edit_name.html.erb b/app/views/locations/edit_name.html.erb index 0bc469a94..087ca0812 100644 --- a/app/views/locations/edit_name.html.erb +++ b/app/views/locations/edit_name.html.erb @@ -7,13 +7,13 @@ ) %> <% end %> -<%= render partial: "organisations/headings", locals: { main: "Location name for #{@location.postcode}", sub: @scheme.service_name } %> - <%= form_for(@location, method: :patch, url: location_path(location_id: @location.id)) do |f| %>
<%= f.govuk_error_summary %> + <%= render partial: "organisations/headings", locals: { main: "Location name for #{@location.postcode}", sub: @scheme.service_name } %> + <%= f.govuk_text_field :name, label: { hidden: true }, hint: { text: "This is how you refer to this location within your organisation" } %> diff --git a/app/views/locations/new.html.erb b/app/views/locations/new.html.erb index 184fed8bb..71690f8e6 100644 --- a/app/views/locations/new.html.erb +++ b/app/views/locations/new.html.erb @@ -7,13 +7,13 @@ ) %> <% end %> -<%= render partial: "organisations/headings", locals: { main: "Add a location to this scheme", sub: @scheme.service_name } %> - <%= form_for(@location, method: :post, url: locations_path) do |f| %>
<%= f.govuk_error_summary %> + <%= render partial: "organisations/headings", locals: { main: "Add a location to this scheme", sub: @scheme.service_name } %> + <%= f.govuk_text_field :postcode, label: { size: "m" }, hint: { text: I18n.t("hints.location.postcode") }, diff --git a/app/views/schemes/check_answers.html.erb b/app/views/schemes/check_answers.html.erb index 1659e16d6..7319259f4 100644 --- a/app/views/schemes/check_answers.html.erb +++ b/app/views/schemes/check_answers.html.erb @@ -1,8 +1,9 @@ -<% content_for :title, "Check your answers before creating this scheme" %> -<%= render partial: "organisations/headings", locals: { main: "Check your changes before creating this scheme", sub: @scheme.service_name } %> - <%= form_for(@scheme, as: :scheme, method: :patch) do |f| %> <%= f.govuk_error_summary %> + + <% content_for :title, "Check your answers before creating this scheme" %> + <%= render partial: "organisations/headings", locals: { main: "Check your changes before creating this scheme", sub: @scheme.service_name } %> + <%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %> <% component.tab(label: "Scheme") do %>

Scheme

diff --git a/app/views/schemes/details.html.erb b/app/views/schemes/details.html.erb index 0e756bad1..4d45213f3 100644 --- a/app/views/schemes/details.html.erb +++ b/app/views/schemes/details.html.erb @@ -7,13 +7,13 @@ ) %> <% end %> -<%= render partial: "organisations/headings", locals: { main: "Create a new supported housing scheme", sub: nil } %> - <%= form_for(@scheme, method: :patch) do |f| %>
<%= f.govuk_error_summary %> + <%= render partial: "organisations/headings", locals: { main: "Create a new supported housing scheme", sub: nil } %> + <%= f.govuk_text_field :service_name, label: { text: "Scheme name", size: "m" }, hint: { text: "This is how you refer to this supported housing scheme within your organisation. For example, the name could relate to the address or location. You’ll be able to see the client group when selecting it." } %> diff --git a/app/views/schemes/edit_name.html.erb b/app/views/schemes/edit_name.html.erb index 8ce38c9d6..04e28c93a 100644 --- a/app/views/schemes/edit_name.html.erb +++ b/app/views/schemes/edit_name.html.erb @@ -7,13 +7,13 @@ ) %> <% end %> -<%= render partial: "organisations/headings", locals: { main: "Scheme details", sub: @scheme.service_name } %> - <%= form_for(@scheme, method: :patch) do |f| %>
<%= f.govuk_error_summary %> + <%= render partial: "organisations/headings", locals: { main: "Scheme details", sub: @scheme.service_name } %> + <%= f.govuk_text_field :service_name, label: { text: "Scheme name", size: "m" }, hint: { text: "This is how you refer to this supported housing scheme within your organisation. For example, the name could relate to the address or location. You’ll be able to see the client group when selecting it." } %> diff --git a/app/views/schemes/new.html.erb b/app/views/schemes/new.html.erb index a7f52ea1c..ff4f4d3a9 100644 --- a/app/views/schemes/new.html.erb +++ b/app/views/schemes/new.html.erb @@ -1,17 +1,17 @@ -<% content_for :title, "Create a new supported housing scheme" %> - -<% content_for :before_content do %> - <%= govuk_back_link( - text: "Back", - href: "javascript:history.go(-1);", - ) %> -<% end %> - <%= form_for(@scheme, as: :scheme, method: :post) do |f| %>
<%= f.govuk_error_summary %> + <% content_for :title, "Create a new supported housing scheme" %> + + <% content_for :before_content do %> + <%= govuk_back_link( + text: "Back", + href: "javascript:history.go(-1);", + ) %> + <% end %> +

<%= content_for(:title) %>

diff --git a/app/views/schemes/primary_client_group.html.erb b/app/views/schemes/primary_client_group.html.erb index 2b1407b1a..f956884bb 100644 --- a/app/views/schemes/primary_client_group.html.erb +++ b/app/views/schemes/primary_client_group.html.erb @@ -15,13 +15,13 @@ ) %> <% end %> -<%= render partial: "organisations/headings", locals: { main: "What client group is this scheme intended for?", sub: @scheme.service_name } %> - <%= form_for(@scheme, method: :patch) do |f| %>
<%= f.govuk_error_summary %> + <%= render partial: "organisations/headings", locals: { main: "What client group is this scheme intended for?", sub: @scheme.service_name } %> + <% primary_client_group_selection = Scheme.primary_client_groups.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key) } %> <%= f.govuk_collection_radio_buttons :primary_client_group, primary_client_group_selection, diff --git a/app/views/schemes/secondary_client_group.html.erb b/app/views/schemes/secondary_client_group.html.erb index 5ef5b1a1a..d229883ba 100644 --- a/app/views/schemes/secondary_client_group.html.erb +++ b/app/views/schemes/secondary_client_group.html.erb @@ -7,13 +7,13 @@ ) %> <% end %> -<%= render partial: "organisations/headings", locals: { main: "What is the other client group?", sub: @scheme.service_name } %> - <%= form_for(@scheme, method: :patch) do |f| %>
<%= f.govuk_error_summary %> + <%= render partial: "organisations/headings", locals: { main: "What is the other client group?", sub: @scheme.service_name } %> + <% secondary_client_group_selection = Scheme.secondary_client_groups.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key) } %> <%= f.govuk_collection_radio_buttons :secondary_client_group, secondary_client_group_selection, diff --git a/app/views/schemes/support.html.erb b/app/views/schemes/support.html.erb index 451c11402..0c06a059f 100644 --- a/app/views/schemes/support.html.erb +++ b/app/views/schemes/support.html.erb @@ -7,13 +7,13 @@ ) %> <% end %> -<%= render partial: "organisations/headings", locals: { main: "What support does this scheme provide?", sub: @scheme.service_name } %> - <%= form_for(@scheme, method: :patch) do |f| %>
<%= f.govuk_error_summary %> + <%= render partial: "organisations/headings", locals: { main: "What support does this scheme provide?", sub: @scheme.service_name } %> + <% 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]) } %>