From 0ee2f7edb456a89e8754c950213a70eff5ae0506 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Thu, 25 Apr 2024 11:24:26 +0100 Subject: [PATCH] Improve how regional content is shown This standardises how we show region content and ensures that any content related to the written statement (from the status or the sanction checks) are shown in the request professional standing certificate page. --- .../qualifications_controller.rb | 8 +--- .../qualification_view_object.rb | 18 -------- ...professional_standing_certificate.html.erb | 42 ++++++++++++++++-- .../qualifications/_form.html.erb | 10 ++++- .../qualification_view_object_spec.rb | 44 ------------------- 5 files changed, 47 insertions(+), 75 deletions(-) delete mode 100644 app/view_objects/teacher_interface/qualification_view_object.rb delete mode 100644 spec/view_objects/teacher_interface/qualification_view_object_spec.rb diff --git a/app/controllers/teacher_interface/qualifications_controller.rb b/app/controllers/teacher_interface/qualifications_controller.rb index cdf036fac6..5f6ad02550 100644 --- a/app/controllers/teacher_interface/qualifications_controller.rb +++ b/app/controllers/teacher_interface/qualifications_controller.rb @@ -43,15 +43,13 @@ def check_collection def new qualification = Qualification.new(application_form:) - @view_object = QualificationViewObject.new(qualification:) + @form = QualificationForm.new(qualification:) end def create qualification = Qualification.new(application_form:) - @view_object = QualificationViewObject.new(qualification:) - @form = QualificationForm.new(qualification_form_params.merge(qualification:)) @@ -158,8 +156,6 @@ def submit_add_another def edit @qualification = qualification - @view_object = QualificationViewObject.new(qualification:) - @form = QualificationForm.new( qualification:, @@ -176,8 +172,6 @@ def edit def update @qualification = qualification - @view_object = QualificationViewObject.new(qualification:) - @form = QualificationForm.new(qualification_form_params.merge(qualification:)) diff --git a/app/view_objects/teacher_interface/qualification_view_object.rb b/app/view_objects/teacher_interface/qualification_view_object.rb deleted file mode 100644 index a3a252ec62..0000000000 --- a/app/view_objects/teacher_interface/qualification_view_object.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -class TeacherInterface::QualificationViewObject - attr_reader :qualification - - def initialize(qualification:) - @qualification = qualification - end - - def qualifications_information - region = qualification.application_form.region - - [ - region.qualifications_information, - region.country.qualifications_information, - ].compact_blank.join("\n\n") - end -end diff --git a/app/views/teacher_interface/application_forms/show/_request_professional_standing_certificate.html.erb b/app/views/teacher_interface/application_forms/show/_request_professional_standing_certificate.html.erb index 9336f32412..b8511e29ed 100644 --- a/app/views/teacher_interface/application_forms/show/_request_professional_standing_certificate.html.erb +++ b/app/views/teacher_interface/application_forms/show/_request_professional_standing_certificate.html.erb @@ -1,8 +1,42 @@ -

You should now request your <%= region_certificate_name(view_object.region) %>

-

You should now request your <%= region_certificate_name(view_object.region) %> from <%= region_teaching_authority_name(view_object.region) %>.

-

Contact them directly and instruct them to send the document to <%= govuk_link_to t("service.email.verification"), email_path("verification") %>.

+

+ You should now request your <%= region_certificate_name(view_object.region) %> +

+ +

+ You should now request your <%= region_certificate_name(view_object.region) %> from <%= region_teaching_authority_name(view_object.region) %>. +

+ +

+ Contact them directly and instruct them to send the document to <%= govuk_link_to t("service.email.verification"), email_path("verification") %>. +

+

Important information about your <%= region_certificate_name(view_object.region) %>

-

Once you've submitted your application, we’ll notify <%= region_teaching_authority_name(view_object.region) %> that you’ve applied for QTS. You do not need to contact us to get written confirmation of this.

+ +<% if view_object.region.teaching_authority_requires_submission_email %> +

+ Once you’ve submitted your application, we’ll notify <%= region_teaching_authority_name_phrase(view_object.region) %> that you’ve applied for QTS. You do not need to contact us to get written confirmation of this. +

+<% end %> + +<% if view_object.region.status_check_written? %> + <% if view_object.region.status_information.present? %> + <%= raw GovukMarkdown.render(view_object.region.status_information) %> + <% end %> + + <% if view_object.region.country.status_information.present? %> + <%= raw GovukMarkdown.render(view_object.region.country.status_information) %> + <% end %> +<% end %> + +<% if view_object.region.sanction_check_written? %> + <% if view_object.region.sanction_information.present? %> + <%= raw GovukMarkdown.render(view_object.region.sanction_information) %> + <% end %> + + <% if view_object.region.country.sanction_information.present? %> + <%= raw GovukMarkdown.render(view_object.region.country.sanction_information) %> + <% end %> +<% end %> <% if view_object.region.other_information.present? %> <%= raw GovukMarkdown.render(view_object.region.other_information) %> diff --git a/app/views/teacher_interface/qualifications/_form.html.erb b/app/views/teacher_interface/qualifications/_form.html.erb index 530061a4d4..5bd68ebadd 100644 --- a/app/views/teacher_interface/qualifications/_form.html.erb +++ b/app/views/teacher_interface/qualifications/_form.html.erb @@ -28,9 +28,15 @@

Add any additional qualifications you have that relate to your teaching career. These must be of a <%= govuk_link_to "UK ‘level 6’ equivalent or above", "https://www.gov.uk/what-different-qualification-levels-mean/list-of-qualification-levels" %>.

<% end %> - <% if view_object.qualifications_information.present? %> + <% if @application_form.region.qualifications_information.present? || @application_form.region.country.qualifications_information.present? %>
- <%= raw GovukMarkdown.render(view_object.qualifications_information) %> + <% if @application_form.region.qualifications_information.present? %> + <%= raw GovukMarkdown.render(@application_form.region.qualifications_information) %> + <% end %> + + <% if @application_form.region.country.qualifications_information.present? %> + <%= raw GovukMarkdown.render(@application_form.region.country.qualifications_information) %> + <% end %>
<% end %> diff --git a/spec/view_objects/teacher_interface/qualification_view_object_spec.rb b/spec/view_objects/teacher_interface/qualification_view_object_spec.rb deleted file mode 100644 index 4ee8cf5c01..0000000000 --- a/spec/view_objects/teacher_interface/qualification_view_object_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -RSpec.describe TeacherInterface::QualificationViewObject do - subject(:view_object) { described_class.new(qualification:) } - - let(:qualification) { create(:qualification) } - - describe "#qualifications_information" do - let(:info) { "Qualifications info" } - - context "when country has qualifications information" do - it "returns qualifications info for the country" do - qualification.application_form.region.country.update!( - qualifications_information: info, - ) - expect(view_object.qualifications_information).to eq( - "Qualifications info", - ) - end - end - - context "when region has qualifications information" do - it "returns qualifications info for the country and the region" do - qualification.application_form.region.country.update!( - qualifications_information: "Country specific info", - ) - qualification.application_form.region.update!( - qualifications_information: info, - ) - expect(view_object.qualifications_information).to eq( - "Qualifications info\n\nCountry specific info", - ) - end - end - - context "with no qualifications information" do - it "returns blank" do - expect(view_object.qualifications_information).to be_blank - end - end - end -end