From 3569a39803edb3c5a8c1647438c9694d790c49a9 Mon Sep 17 00:00:00 2001 From: CatalinVoineag <11318084+CatalinVoineag@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:46:27 +0100 Subject: [PATCH] Redesign visa sponsorship on course page The International students section is going to be removed from the publis/find course show pages. This is part of a redesign of the course page to make it easier for users to view the information without being overwhelmed The visa sponsorship content will now be in a drop-down details tag. The content inside has also been tweaked. --- .../courses/contents_component/view.html.erb | 1 - .../view.html.erb | 14 +++-- .../international_students_component/view.rb | 18 +++++- .../courses/summary_component/view.html.erb | 4 +- .../find/courses/summary_component/view.rb | 24 -------- app/helpers/view_helper.rb | 24 ++++++++ app/views/find/courses/show.html.erb | 2 - app/views/publish/courses/preview.html.erb | 2 - config/locales/find.yml | 23 ++++--- .../view_spec.rb | 12 +--- .../find/search/viewing_a_course_spec.rb | 9 ++- .../publish/viewing_a_course_preview_spec.rb | 4 ++ spec/helpers/view_helper_spec.rb | 60 +++++++++++++++++++ spec/support/page_objects/find/course_show.rb | 1 - 14 files changed, 134 insertions(+), 64 deletions(-) diff --git a/app/components/find/courses/contents_component/view.html.erb b/app/components/find/courses/contents_component/view.html.erb index 77487721a6..567e6e8a7e 100644 --- a/app/components/find/courses/contents_component/view.html.erb +++ b/app/components/find/courses/contents_component/view.html.erb @@ -14,7 +14,6 @@ <% if interview_process.present? %>
  • <%= govuk_link_to "Interview process", "#section-interviews" %>
  • <% end %> -
  • <%= govuk_link_to "International candidates", "#section-international-students" %>
  • <% if provider.train_with_disability.present? || preview? %>
  • <%= govuk_link_to "Training with disabilities", "#section-train-with-disabilities" %>
  • <% end %> diff --git a/app/components/find/courses/international_students_component/view.html.erb b/app/components/find/courses/international_students_component/view.html.erb index c8ec1dfad0..d5b0c66963 100644 --- a/app/components/find/courses/international_students_component/view.html.erb +++ b/app/components/find/courses/international_students_component/view.html.erb @@ -1,5 +1,4 @@ -
    -

    International candidates

    +<%= govuk_details(summary_text: visa_sponsorship_summary) do %>
    <% if apprenticeship? %> @@ -10,7 +9,9 @@ EEA, Switzerland, Gibraltar, or the UK for at least the previous 3 years will also be eligible.

    <% end %> -

    <%= apprenticeship? ? "You’ll also" : "You’ll" %> need the <%= right_required %> in the UK. You already have this if, for example, you:

    +

    <%= apprenticeship? ? "You’ll also" : "You’ll" %> need the <%= right_required %> in the UK

    + +

    You already have this if, for example, you:

    - <%= t("find.international_candidates.#{visa_type}.#{sponsorship_availability}.html") %> + <%= t( + "find.international_candidates.#{visa_type}.#{sponsorship_availability}.html", + provider_url: x_provider_url + ) %>

    Learn more about <%= govuk_link_to("training to teach in England as an international student", t("find.get_into_teaching.url_train_to_teach_as_international_candidate")) %>.

    -
    +<% end %> diff --git a/app/components/find/courses/international_students_component/view.rb b/app/components/find/courses/international_students_component/view.rb index e078686412..35d281f338 100644 --- a/app/components/find/courses/international_students_component/view.rb +++ b/app/components/find/courses/international_students_component/view.rb @@ -4,9 +4,15 @@ module Find module Courses module InternationalStudentsComponent class View < ViewComponent::Base + include ::ViewHelper + include PreviewHelper attr_reader :course - delegate :apprenticeship?, to: :course + delegate :apprenticeship?, + :salaried?, + :can_sponsor_student_visa, + :can_sponsor_skilled_worker_visa, + to: :course def initialize(course:) super @@ -32,6 +38,16 @@ def sponsorship_availability def course_subject_codes @course_subject_codes ||= course.subjects.pluck(:subject_code).compact end + + def visa_sponsorship_summary + if !salaried? && can_sponsor_student_visa + t('.student_visas_can_be_sponsored') + elsif salaried? && can_sponsor_skilled_worker_visa + t('.skilled_worker_visas_can_be_sponsored') + else + t('.visas_cannot_be_sponsored') + end + end end end end diff --git a/app/components/find/courses/summary_component/view.html.erb b/app/components/find/courses/summary_component/view.html.erb index ede1910804..656bc4cbb8 100644 --- a/app/components/find/courses/summary_component/view.html.erb +++ b/app/components/find/courses/summary_component/view.html.erb @@ -68,6 +68,8 @@ <% summary_list.with_row do |row| %> <% row.with_key(text: t(".visa_sponsorship")) %> - <% row.with_value(text: visa_sponsorship_row) %> + <% row.with_value do %> + <%= render Find::Courses::InternationalStudentsComponent::View.new(course:) %> + <% end %> <% end %> <% end %> diff --git a/app/components/find/courses/summary_component/view.rb b/app/components/find/courses/summary_component/view.rb index 7b5bf8038a..cce86d8211 100644 --- a/app/components/find/courses/summary_component/view.rb +++ b/app/components/find/courses/summary_component/view.rb @@ -75,30 +75,6 @@ def no_fee? def show_apply_from_row? course.applications_open_from&.future? end - - def x_provider_url - if preview?(params) - provider_publish_provider_recruitment_cycle_course_path( - course.provider_code, - course.recruitment_cycle_year, - course.course_code - ) - else - find_provider_path(course.provider_code, course.course_code) - end - end - - def x_accrediting_provider_url - if preview?(params) - accredited_by_publish_provider_recruitment_cycle_course_path( - course.provider_code, - course.recruitment_cycle_year, - course.course_code - ) - else - find_accrediting_provider_path(course.provider_code, course.course_code) - end - end end end end diff --git a/app/helpers/view_helper.rb b/app/helpers/view_helper.rb index dce728ae2d..308db31a11 100644 --- a/app/helpers/view_helper.rb +++ b/app/helpers/view_helper.rb @@ -151,6 +151,30 @@ def classnames(*args) alias cns classnames + def x_provider_url + if preview?(params) + provider_publish_provider_recruitment_cycle_course_path( + course.provider_code, + course.recruitment_cycle_year, + course.course_code + ) + else + find_provider_path(course.provider_code, course.course_code) + end + end + + def x_accrediting_provider_url + if preview?(params) + accredited_by_publish_provider_recruitment_cycle_course_path( + course.provider_code, + course.recruitment_cycle_year, + course.course_code + ) + else + find_accrediting_provider_path(course.provider_code, course.course_code) + end + end + private def base_errors_hash(provider_code, course) diff --git a/app/views/find/courses/show.html.erb b/app/views/find/courses/show.html.erb index 8cc136a8a3..fb714c582a 100644 --- a/app/views/find/courses/show.html.erb +++ b/app/views/find/courses/show.html.erb @@ -51,8 +51,6 @@ <%= render partial: "find/courses/interview_process", locals: { course: @course } %> <% end %> - <%= render Find::Courses::InternationalStudentsComponent::View.new(course: @course) %> - <% if @provider.train_with_disability.present? %>

    <%= t(".training_with_disabilities") %> diff --git a/app/views/publish/courses/preview.html.erb b/app/views/publish/courses/preview.html.erb index 7c6ff4356b..00464da24f 100644 --- a/app/views/publish/courses/preview.html.erb +++ b/app/views/publish/courses/preview.html.erb @@ -41,8 +41,6 @@ <%= render partial: "find/courses/interview_process", locals: { course: } %> <% end %> - <%= render Find::Courses::InternationalStudentsComponent::View.new(course:) %> -

    <%= t(".training_with_disabilities") %>

    diff --git a/config/locales/find.yml b/config/locales/find.yml index 372dd4bfd2..696dc35fac 100644 --- a/config/locales/find.yml +++ b/config/locales/find.yml @@ -73,6 +73,11 @@ en: courses: train_with_disabilities: heading: Training with disabilities and other needs at %{provider_name} + international_students_component: + view: + student_visas_can_be_sponsored: Student visas can be sponsored + skilled_worker_visas_can_be_sponsored: Skilled Worker visas can be sponsored + visas_cannot_be_sponsored: Visas cannot be sponsored summary_component: view: fee_or_salary: Fee or salary @@ -149,27 +154,21 @@ en: skilled_worker_visa: not_available: html: -

    If you do not already have the right to work in the UK, you may need to apply for a visa. The main visa for salaried courses is the Skilled Worker visa.

    -

    Sponsorship for a Skilled Worker visa is not available for this course.

    -

    If you need a visa, filter your course search to find courses with visa sponsorship.

    -

    You can also learn more about different types of visa which allow you to train to be a teacher without being sponsored.

    +

    If you do not already have the right to study in the UK, you may need to apply for your visa to train to teach in England.

    available: html: -

    If you do not already have the right to work in the UK for the duration of this course, you may need to apply for a Skilled Worker visa.

    +

    If you do not already have the right to work in the UK, you may need to apply for your visa to train to teach in England.

    To do this, you’ll need to be sponsored by your employer.

    -

    Before you apply for this course, contact us to check Skilled Worker visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.

    +

    Before you apply for this course, contact the training provider to check Skilled Worker visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.

    student_visa: not_available: html: -

    If you do not already have the right to study in the UK, you may need to apply for a visa.

    -

    Sponsorship for a student visa is not available for this course.

    -

    If you need a visa, filter your course search to find courses with visa sponsorship.

    -

    You can also learn more about different types of visa which allow you to train to be a teacher without being sponsored.

    +

    If you do not already have the right to study in the UK, you may need to apply for your visa to train to teach in England.

    available: html: -

    If you do not already have the right to study in the UK for the duration of this course, you may need to apply for a Student visa.

    +

    If you do not already have the right to study in the UK, you may need to apply for your visa to train to teach in England.

    To do this, you’ll need to be sponsored by your training provider.

    -

    Before you apply for this course, contact us to check Student visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.

    +

    Before you apply for this course, contact the training provider to check Student visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.

    entitlement: html:

    You may be entitled to £10,000 from the UK government to help with the financial costs of moving to England.

    diff --git a/spec/components/find/courses/international_students_component/view_spec.rb b/spec/components/find/courses/international_students_component/view_spec.rb index 35e1da11b7..ecdd153e17 100644 --- a/spec/components/find/courses/international_students_component/view_spec.rb +++ b/spec/components/find/courses/international_students_component/view_spec.rb @@ -16,10 +16,6 @@ it 'tells candidates they’ll need the right to study' do expect(page).to have_text('You’ll need the right to study in the UK') end - - it 'tells candidates sponsorship is not available' do - expect(page).to have_text('Sponsorship for a student visa is not available for this course') - end end context 'when the course is fee-paying and does sponsor Student visas' do @@ -37,7 +33,7 @@ end it 'tells candidates visa sponsorship may be available, but they should check' do - expect(page).to have_text('Before you apply for this course, contact us to check Student visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.') + expect(page).to have_text('Before you apply for this course, contact the training provider to check Student visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.') end it 'does not tell candidates the 3-year residency rule' do @@ -64,7 +60,7 @@ end it 'tells candidates visa sponsorship may be available, but they should check' do - expect(page).to have_text('Before you apply for this course, contact us to check Skilled Worker visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.') + expect(page).to have_text('Before you apply for this course, contact the training provider to check Skilled Worker visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.') end end @@ -82,10 +78,6 @@ expect(page).to have_text('You’ll need the right to work in the UK') end - it 'tells candidates visa sponsorship is not available' do - expect(page).to have_text('Sponsorship for a Skilled Worker visa is not available for this course') - end - it 'does not tell candidates the 3-year residency rule' do expect(page).to have_no_text('To apply for this teaching apprenticeship course, you’ll need to have lived in the UK for at least 3 years before the start of the course') end diff --git a/spec/features/find/search/viewing_a_course_spec.rb b/spec/features/find/search/viewing_a_course_spec.rb index 5816a66bba..8ea8e70c46 100644 --- a/spec/features/find/search/viewing_a_course_spec.rb +++ b/spec/features/find/search/viewing_a_course_spec.rb @@ -188,6 +188,10 @@ def then_i_should_see_the_course_information 'QTS with PGCE' ) + expect(find_course_show_page).to have_content( + 'Student visas can be sponsored' + ) + expect(find_course_show_page).to have_content( '11 to 18' ) @@ -242,11 +246,6 @@ def then_i_should_see_the_course_information @course.latest_published_enrichment.required_qualifications ) - expect(find_course_show_page).to have_international_students - expect(find_course_show_page.international_students).to have_content( - 'Before you apply for this course, contact us to check Student visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.' - ) - expect(find_course_show_page.required_qualifications).to have_content( 'Grade 4 (C) or above in English and maths, or equivalent qualification.' ) diff --git a/spec/features/publish/viewing_a_course_preview_spec.rb b/spec/features/publish/viewing_a_course_preview_spec.rb index 4387b52028..f6adae9a4d 100644 --- a/spec/features/publish/viewing_a_course_preview_spec.rb +++ b/spec/features/publish/viewing_a_course_preview_spec.rb @@ -187,6 +187,10 @@ def then_i_see_the_course_preview_details 'QTS with PGCE' ) + expect(publish_course_preview_page).to have_content( + 'Visas cannot be sponsored' + ) + expect(publish_course_preview_page).to have_content( '11 to 18' ) diff --git a/spec/helpers/view_helper_spec.rb b/spec/helpers/view_helper_spec.rb index 63fc5ad0fb..ed8d78b64a 100644 --- a/spec/helpers/view_helper_spec.rb +++ b/spec/helpers/view_helper_spec.rb @@ -3,6 +3,9 @@ require 'rails_helper' describe ViewHelper do + include PreviewHelper + include Rails.application.routes.url_helpers + describe '#enrichment_error_url' do let(:provider) { build(:provider, recruitment_cycle: build(:recruitment_cycle)) } let(:course) { build(:course, provider:) } @@ -27,4 +30,61 @@ expect(provider_enrichment_error_url(provider:, field: 'email')).to eq("/publish/organisations/#{provider.provider_code}/#{provider.recruitment_cycle.year}/contact?display_errors=true#provider_email") end end + + describe '#x_provider_url' do + let(:course) { create(:course) } + + context 'when preview? is true' do + def preview?(_) = true + + it 'returns the publish provider url' do + expect(x_provider_url).to eq( + provider_publish_provider_recruitment_cycle_course_path( + course.provider_code, + course.recruitment_cycle_year, + course.course_code + ) + ) + end + end + + context 'when preview? is false' do + def preview?(_) = false + + it 'returns the find provider url' do + expect(x_provider_url).to eq( + find_provider_path(course.provider_code, course.course_code) + ) + end + end + end + + describe '#x_accrediting_provider_url +' do + let(:course) { create(:course) } + + context 'when preview? is true' do + def preview?(_) = true + + it 'returns the publish accrediting provider url' do + expect(x_accrediting_provider_url).to eq( + accredited_by_publish_provider_recruitment_cycle_course_path( + course.provider_code, + course.recruitment_cycle_year, + course.course_code + ) + ) + end + end + + context 'when preview? is false' do + def preview?(_) = false + + it 'returns the find accrediting provider url' do + expect(x_accrediting_provider_url).to eq( + find_accrediting_provider_path(course.provider_code, course.course_code) + ) + end + end + end end diff --git a/spec/support/page_objects/find/course_show.rb b/spec/support/page_objects/find/course_show.rb index 741ec57dfa..cea512025e 100644 --- a/spec/support/page_objects/find/course_show.rb +++ b/spec/support/page_objects/find/course_show.rb @@ -26,7 +26,6 @@ class CourseShow < PageObjects::Base element :required_qualifications, '[data-qa=course__required_qualifications]' element :train_with_us, '[data-qa=course__about_provider]' element :about_accrediting_provider, '[data-qa=course__about_accrediting_provider]' - element :international_students, '[data-qa=course__international_students]' element :train_with_disability, '[data-qa=course__train_with_disabilities]' element :course_advice, '#section-advice' element :course_apply, '#section-apply'