From 134824f2da41002766d4894701b70b5fac2c8285 Mon Sep 17 00:00:00 2001 From: Lori Bailey <44073106+elceebee@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:38:48 +0000 Subject: [PATCH] Implement post-release one login banner for sign in page Co-Authored-By: avinhurry <50492247+avinhurry@users.noreply.github.com> --- ..._release_sign_in_banner_component.html.erb | 4 +++ ...n_post_release_sign_in_banner_component.rb | 7 +++++ .../create_account_or_sign_in.html.erb | 1 + ..._post_release_sign_in_banner_component.yml | 8 ++++++ ...t_release_sign_in_banner_component_spec.rb | 27 +++++++++++++++++++ .../one_login_pre_release_banners_preview.rb | 4 +++ 6 files changed, 51 insertions(+) create mode 100644 app/components/candidate_interface/one_login_post_release_sign_in_banner_component.html.erb create mode 100644 app/components/candidate_interface/one_login_post_release_sign_in_banner_component.rb create mode 100644 config/locales/components/candidate_interface/one_login_post_release_sign_in_banner_component.yml create mode 100644 spec/components/candidate_interface/one_login_post_release_sign_in_banner_component_spec.rb diff --git a/app/components/candidate_interface/one_login_post_release_sign_in_banner_component.html.erb b/app/components/candidate_interface/one_login_post_release_sign_in_banner_component.html.erb new file mode 100644 index 00000000000..c2bc064f398 --- /dev/null +++ b/app/components/candidate_interface/one_login_post_release_sign_in_banner_component.html.erb @@ -0,0 +1,4 @@ +<%= govuk_notification_banner(title_text: t('.title')) do |banner| %> + <% banner.with_heading(text: t('.heading')) %> + <%= t('.text_html') %> +<% end %> diff --git a/app/components/candidate_interface/one_login_post_release_sign_in_banner_component.rb b/app/components/candidate_interface/one_login_post_release_sign_in_banner_component.rb new file mode 100644 index 00000000000..406085c336b --- /dev/null +++ b/app/components/candidate_interface/one_login_post_release_sign_in_banner_component.rb @@ -0,0 +1,7 @@ +module CandidateInterface + class OneLoginPostReleaseSignInBannerComponent < ViewComponent::Base + def render? + FeatureFlag.active?(:one_login_candidate_sign_in) + end + end +end diff --git a/app/views/candidate_interface/start_page/create_account_or_sign_in.html.erb b/app/views/candidate_interface/start_page/create_account_or_sign_in.html.erb index 77d2891fcb5..ab4731b4fb0 100644 --- a/app/views/candidate_interface/start_page/create_account_or_sign_in.html.erb +++ b/app/views/candidate_interface/start_page/create_account_or_sign_in.html.erb @@ -5,6 +5,7 @@
<%= render CandidateInterface::OneLoginPreReleaseSignInBannerComponent.new %> + <%= render CandidateInterface::OneLoginPostReleaseSignInBannerComponent.new %> <% if FeatureFlag.active?(:one_login_candidate_sign_in) %> diff --git a/config/locales/components/candidate_interface/one_login_post_release_sign_in_banner_component.yml b/config/locales/components/candidate_interface/one_login_post_release_sign_in_banner_component.yml new file mode 100644 index 00000000000..e827bda6d6e --- /dev/null +++ b/config/locales/components/candidate_interface/one_login_post_release_sign_in_banner_component.yml @@ -0,0 +1,8 @@ +en: + candidate_interface: + one_login_post_release_sign_in_banner_component: + title: Important + heading: How you sign in has changed + text_html: +

Sign in using your GOV.UK One Login. If you do not have one you can create one.

+

If you have signed in to Apply for teacher training before, you should use the same email address to create your GOV.UK One Login.

diff --git a/spec/components/candidate_interface/one_login_post_release_sign_in_banner_component_spec.rb b/spec/components/candidate_interface/one_login_post_release_sign_in_banner_component_spec.rb new file mode 100644 index 00000000000..1885540c902 --- /dev/null +++ b/spec/components/candidate_interface/one_login_post_release_sign_in_banner_component_spec.rb @@ -0,0 +1,27 @@ +require 'rails_helper' + +RSpec.describe CandidateInterface::OneLoginPostReleaseSignInBannerComponent do + context 'One login is deactivated' do + before do + FeatureFlag.deactivate(:one_login_candidate_sign_in) + end + + it 'does not renders the component' do + result = render_inline(described_class.new) + expect(result.content).to be_empty + end + end + + context 'One login is activated' do + before do + FeatureFlag.activate(:one_login_candidate_sign_in) + end + + it 'does render the component' do + result = render_inline(described_class.new) + expect(result).to have_content 'How you sign in has changed' + expect(result).to have_content 'Sign in using your GOV.UK One Login. If you do not have one you can create one.' + expect(result).to have_content 'If you have signed in to Apply for teacher training before, you should use the same email address to create your GOV.UK One Login.' + end + end +end diff --git a/spec/components/previews/candidate_interface/one_login_pre_release_banners_preview.rb b/spec/components/previews/candidate_interface/one_login_pre_release_banners_preview.rb index fbd2738e658..90a9010ae43 100644 --- a/spec/components/previews/candidate_interface/one_login_pre_release_banners_preview.rb +++ b/spec/components/previews/candidate_interface/one_login_pre_release_banners_preview.rb @@ -7,5 +7,9 @@ def one_login_pre_release_logged_in_banner_component def one_login_pre_release_sign_in_banner_component render(CandidateInterface::OneLoginPreReleaseSignInBannerComponent.new) end + + def one_login_post_release_sign_in_banner_component + render CandidateInterface::OneLoginPostReleaseSignInBannerComponent.new + end end end