From c6353af0659c006f63001e2510a0999ab8910947 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Wed, 25 Sep 2024 08:53:41 +0100 Subject: [PATCH] Rename consent school step The school step is being split in to two separate steps (first to confirm if the school is correct, second is to choose a different school if it's not). This change renames the `school` step to `confirm_school` and I anticipate adding a `different_school` step for when we want to choose a school. --- .../parent_interface/consent_forms/edit_controller.rb | 5 +++-- app/models/consent_form.rb | 4 ++-- .../consent_forms/cannot_consent_school.html.erb | 2 +- .../edit/{school.html.erb => confirm_school.html.erb} | 0 config/locales/en.yml | 1 + spec/models/consent_form_spec.rb | 4 ++-- 6 files changed, 9 insertions(+), 7 deletions(-) rename app/views/parent_interface/consent_forms/edit/{school.html.erb => confirm_school.html.erb} (100%) diff --git a/app/controllers/parent_interface/consent_forms/edit_controller.rb b/app/controllers/parent_interface/consent_forms/edit_controller.rb index 5d543b3f0..00b7df9be 100644 --- a/app/controllers/parent_interface/consent_forms/edit_controller.rb +++ b/app/controllers/parent_interface/consent_forms/edit_controller.rb @@ -28,7 +28,8 @@ def update model.assign_attributes(update_params) end - if current_step == :school && @consent_form.is_this_their_school == "no" + if current_step == :confirm_school && + @consent_form.is_this_their_school == "no" redirect_to session_parent_interface_consent_form_cannot_consent_school_path( @session, @consent_form @@ -72,7 +73,7 @@ def update_params date_of_birth(2i) date_of_birth(1i) ], - school: %i[is_this_their_school], + confirm_school: %i[is_this_their_school], parent: %i[ parent_email parent_name diff --git a/app/models/consent_form.rb b/app/models/consent_form.rb index c0b4631cd..8228a2f57 100644 --- a/app/models/consent_form.rb +++ b/app/models/consent_form.rb @@ -171,7 +171,7 @@ class ConsentForm < ApplicationRecord } end - on_wizard_step :school, exact: true do + on_wizard_step :confirm_school, exact: true do validates :is_this_their_school, inclusion: { in: %w[yes no] } end @@ -238,7 +238,7 @@ def wizard_steps [ :name, :date_of_birth, - :school, + :confirm_school, :parent, (:contact_method if parent_phone.present?), :consent, diff --git a/app/views/parent_interface/consent_forms/cannot_consent_school.html.erb b/app/views/parent_interface/consent_forms/cannot_consent_school.html.erb index deff2917b..a3d1df185 100644 --- a/app/views/parent_interface/consent_forms/cannot_consent_school.html.erb +++ b/app/views/parent_interface/consent_forms/cannot_consent_school.html.erb @@ -1,6 +1,6 @@ <% content_for :before_main do %> <%= render AppBacklinkComponent.new( - href: session_parent_interface_consent_form_edit_path(@session, @consent_form, :school), + href: session_parent_interface_consent_form_edit_path(@session, @consent_form, "confirm-school"), name: "edit school page", ) %> <% end %> diff --git a/app/views/parent_interface/consent_forms/edit/school.html.erb b/app/views/parent_interface/consent_forms/edit/confirm_school.html.erb similarity index 100% rename from app/views/parent_interface/consent_forms/edit/school.html.erb rename to app/views/parent_interface/consent_forms/edit/confirm_school.html.erb diff --git a/config/locales/en.yml b/config/locales/en.yml index 536b99042..1937de71f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -634,6 +634,7 @@ en: batch: batch cohort: cohort confirm: confirm + confirm_school: confirm-school consent: consent contact_method: contact-method date_of_birth: date-of-birth diff --git a/spec/models/consent_form_spec.rb b/spec/models/consent_form_spec.rb index 0aa97592f..68affaf65 100644 --- a/spec/models/consent_form_spec.rb +++ b/spec/models/consent_form_spec.rb @@ -118,8 +118,8 @@ # .on(:update) } end - context "when wizard_step is :school" do - let(:wizard_step) { :school } + context "when wizard_step is :confirm_school" do + let(:wizard_step) { :confirm_school } context "runs validations from previous steps" do it { should validate_presence_of(:first_name).on(:update) }