Skip to content

Commit ed041c7

Browse files
authored
Merge pull request #6198 from NHSDigital/missing-error-message
Add missing error messages to draft school
2 parents 6804efc + 4b147b2 commit ed041c7

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

app/models/draft_school.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,19 @@ def add_site_context?
6868
end
6969

7070
on_wizard_step :confirm_urn, exact: true do
71-
validates :confirm_school, presence: true, inclusion: { in: %w[yes no] }
71+
validates :confirm_school, inclusion: { in: %w[yes no] }
7272
end
7373

7474
on_wizard_step :school, exact: true do
7575
validates :parent_urn_and_site, presence: true
7676
end
7777

7878
on_wizard_step :details, exact: true do
79-
validates :name, presence: true
80-
validates :name, name: { school_name: true }
8179
validates :name,
80+
presence: true,
81+
name: {
82+
school_name: true
83+
},
8284
exclusion: {
8385
in: ->(record) { record.existing_names },
8486
message:

app/views/draft_schools/confirm_urn.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</p>
1313
</div>
1414

15-
<%= form_with(model: @draft_school, url: wizard_path, method: :put) do |form| %>
15+
<%= form_with model: @draft_school, url: wizard_path, method: :put do |form| %>
1616
<%= form.govuk_radio_buttons_fieldset :confirm_school, legend: { text: "Is this the correct school?", size: "s" } do %>
1717
<%= form.govuk_radio_button :confirm_school, :yes, label: { text: "Yes, add this school" } %>
1818
<%= form.govuk_radio_button :confirm_school, :no, label: { text: "No, search again" }, link_errors: true %>

app/views/draft_schools/details.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<%= h1 "Site details" %>
66

7-
<%= form_with(model: @draft_school, url: wizard_path, method: :put) do |f| %>
7+
<%= form_with model: @draft_school, url: wizard_path, method: :put do |f| %>
88
<%= f.govuk_text_field :name, hint: { text: "The site name must be unique. It is shown to parents on the consent form and related emails. Existing sites for this school are: #{@draft_school.existing_names.to_sentence}." } %>
99
<%= f.govuk_text_field :address_line_1, label: { text: "Address line 1" } %>
1010
<%= f.govuk_text_field :address_line_2, label: { text: "Address line 2 (optional)" } %>

config/locales/en.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ en:
7171
inclusion: Choose which type of records you are importing
7272
year_groups:
7373
blank: Choose which year groups you want to import class list records for
74+
draft_school:
75+
attributes:
76+
address_line_1:
77+
blank: Enter an address line 1
78+
address_postcode:
79+
blank: Enter a postcode
80+
address_town:
81+
blank: Enter a town or city
82+
confirm_school:
83+
inclusion: Choose if this is the correct school
84+
name:
85+
blank: Enter a name
7486
draft_session:
7587
attributes:
7688
location_id:

0 commit comments

Comments
 (0)