Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/models/draft_school.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,19 @@ def add_site_context?
end

on_wizard_step :confirm_urn, exact: true do
validates :confirm_school, presence: true, inclusion: { in: %w[yes no] }
validates :confirm_school, inclusion: { in: %w[yes no] }
end

on_wizard_step :school, exact: true do
validates :parent_urn_and_site, presence: true
end

on_wizard_step :details, exact: true do
validates :name, presence: true
validates :name, name: { school_name: true }
validates :name,
presence: true,
name: {
school_name: true
},
exclusion: {
in: ->(record) { record.existing_names },
message:
Expand Down
2 changes: 1 addition & 1 deletion app/views/draft_schools/confirm_urn.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</p>
</div>

<%= form_with(model: @draft_school, url: wizard_path, method: :put) do |form| %>
<%= form_with model: @draft_school, url: wizard_path, method: :put do |form| %>
<%= form.govuk_radio_buttons_fieldset :confirm_school, legend: { text: "Is this the correct school?", size: "s" } do %>
<%= form.govuk_radio_button :confirm_school, :yes, label: { text: "Yes, add this school" } %>
<%= form.govuk_radio_button :confirm_school, :no, label: { text: "No, search again" }, link_errors: true %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/draft_schools/details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<%= h1 "Site details" %>

<%= form_with(model: @draft_school, url: wizard_path, method: :put) do |f| %>
<%= form_with model: @draft_school, url: wizard_path, method: :put do |f| %>
<%= 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}." } %>
<%= f.govuk_text_field :address_line_1, label: { text: "Address line 1" } %>
<%= f.govuk_text_field :address_line_2, label: { text: "Address line 2 (optional)" } %>
Expand Down
12 changes: 12 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ en:
inclusion: Choose which type of records you are importing
year_groups:
blank: Choose which year groups you want to import class list records for
draft_school:
attributes:
address_line_1:
blank: Enter an address line 1
address_postcode:
blank: Enter a postcode
address_town:
blank: Enter a town or city
confirm_school:
inclusion: Choose if this is the correct school
name:
blank: Enter a name
draft_session:
attributes:
location_id:
Expand Down