Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create One Login bridging page #968

Merged
merged 26 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5af4ec3
update account page for one login
jack-coggin Nov 14, 2023
0c96676
Merge branch 'main' into one-login-bridging-page
jack-coggin Nov 14, 2023
adaa702
create gov one bridging page
jack-coggin Nov 14, 2023
226345e
wip
jack-coggin Nov 15, 2023
8410f8f
update bridging page
jack-coggin Nov 15, 2023
b7a8ff5
update homepage
jack-coggin Nov 16, 2023
385e30a
Merge branch 'one-login' into one-login-bridging-page
jack-coggin Nov 16, 2023
2cf7064
update application_helper links, gov_one_helper spec and revert chang…
jack-coggin Nov 16, 2023
784f116
skip whats_new_page_spec and update locales
jack-coggin Nov 16, 2023
7b776be
add route alias for bridging page
jack-coggin Nov 16, 2023
9765caf
extract homepage cta to partial
jack-coggin Nov 16, 2023
6d74e30
remove unnecessary route alias
jack-coggin Nov 16, 2023
65a4a22
resolve merge conflicts:
jack-coggin Nov 16, 2023
f262a40
fix merge conflicts and update locales
jack-coggin Nov 17, 2023
e17b30e
update locales
jack-coggin Nov 17, 2023
391c35b
convert sso auth uri to string in navbar
jack-coggin Nov 17, 2023
2b4f1a5
update system spec
jack-coggin Nov 17, 2023
208c212
update gov one info system spec
jack-coggin Nov 17, 2023
3b7ba6a
styling tweaks
jack-coggin Nov 20, 2023
b556ac3
change div width
jack-coggin Nov 20, 2023
0c6fa46
update locales, rename controller method
jack-coggin Dec 4, 2023
93923c3
Merge branch 'one-login' into one-login-bridging-page
jack-coggin Dec 4, 2023
948fa98
use feature flag in application_helper links
jack-coggin Dec 4, 2023
932ba80
nest gov one info locales
jack-coggin Dec 4, 2023
9c8bdda
simplify gov_one_info spec
jack-coggin Dec 4, 2023
a21cd78
remove link assertion from gov_one_info spec
jack-coggin Dec 4, 2023
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
12 changes: 0 additions & 12 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,6 @@ pre.code-tip {
margin-bottom: govuk-spacing(6);
}

&.enrol-box {
border-radius: 6px;

.govuk-button {
margin: 0;
}
}

}

.float-right {
Expand Down Expand Up @@ -190,7 +182,3 @@ ul>li>ul>li {
.govuk-footer__copyright-logo {
display: none;
}

.white-space-pre-wrap {
white-space: pre-wrap;
}
6 changes: 5 additions & 1 deletion app/controllers/gov_one_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
class GovOneController < ApplicationController
def info; end
layout 'hero'

def show
redirect_to my_modules_path if current_user
end
end
18 changes: 14 additions & 4 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ def navigation
header.with_navigation_item(text: 'Home', href: root_path, classes: %w[dfe-header__navigation-item])
if user_signed_in?
header.with_action_link(text: 'My Account', href: user_path, options: { inverse: true })
header.with_action_link(text: 'Sign out', href: destroy_user_session_path, options: { id: 'sign-out-desktop', data: { turbo_method: :get }, inverse: true })
header.with_action_link(text: 'Sign out', href: logout_path, options: { id: 'sign-out-desktop', data: { turbo_method: :get }, inverse: true })
header.with_navigation_item(text: 'My modules', href: my_modules_path, classes: %w[dfe-header__navigation-item])
header.with_navigation_item(text: 'Learning log', href: user_notes_path, classes: %w[dfe-header__navigation-items]) if current_user.course_started?
header.with_navigation_item(text: 'My account', href: user_path, classes: %w[dfe-header__navigation-item dfe-header-f-mob])
header.with_navigation_item(text: 'Sign out', href: destroy_user_session_path, options: { data: { turbo_method: :get } }, classes: %w[dfe-header__navigation-item dfe-header-f-mob], html_attributes: { id: 'sign-out-f-mob' })
header.with_navigation_item(text: 'Sign out', href: logout_path, options: { data: { turbo_method: :get } }, classes: %w[dfe-header__navigation-item dfe-header-f-mob], html_attributes: { id: 'sign-out-f-mob' })
else
header.with_action_link(text: 'Sign in', href: new_user_session_path, options: { inverse: true })
header.with_navigation_item(text: 'Sign in', href: new_user_session_path, classes: %w[dfe-header__navigation-item dfe-header-f-mob])
header.with_action_link(text: 'Sign in', href: login_path, options: { inverse: true })
header.with_navigation_item(text: 'Sign in', href: login_path, classes: %w[dfe-header__navigation-item dfe-header-f-mob])
end
end
end
Expand Down Expand Up @@ -59,4 +59,14 @@ def html_title(*parts)
def calculate_module_state
CalculateModuleState.new(user: current_user).call
end

# @return [String]
def login_path
Rails.application.gov_one_login? ? gov_one_info_path : new_user_session_path
end

# @return [String]
def logout_path
Rails.application.gov_one_login? ? logout_uri.to_s : destroy_user_session_path
end
end
7 changes: 1 addition & 6 deletions app/helpers/gov_one_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ def logout_uri

# @return [String]
def login_button
govuk_button_link_to t('gov_one_info.sign_in_button'), login_uri.to_s
end

# @return [String]
def logout_button
govuk_button_link_to t('gov_one_info.sign_out_button'), logout_uri.to_s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we also removing the locale/resource? Again, if there are multiple button keys, we can nest them (flips how you read it).

govuk_button_link_to t('gov_one_info.button.sign_in'), login_uri.to_s
end

private
Expand Down
14 changes: 0 additions & 14 deletions app/views/gov_one/info.html.slim

This file was deleted.

28 changes: 28 additions & 0 deletions app/views/gov_one/show.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- content_for :page_title do
= html_title t('home.title')

- content_for :hero do
.govuk-grid-row class='govuk-!-padding-top-9'
.govuk-grid-column-three-quarters
h1.dfe-heading-xl class='govuk-!-margin-bottom-4'
= t('gov_one_info.hero.header')
p.govuk-body-l = t('gov_one_info.hero.body')


.govuk-grid-row
.govuk-grid-column-full
. class='govuk-!-margin-bottom-5'
= m('gov_one_info.body')
hr

= login_button

.govuk-grid-row
.govuk-grid-column-three-quarters class='govuk-!-margin-top-4 govuk-!-margin-bottom-9'
details.govuk-details data-module='govuk-details'
summary.govuk-details__summary
span.govuk-details__summary-text
= t('gov_one_info.details_summary')
.govuk-details__text
= t('gov_one_info.details_text')

2 changes: 2 additions & 0 deletions app/views/home/_chevron.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
svg.govuk-button__start-icon xmlns='http://www.w3.org/2000/svg' width='17.5' height='19' viewBox='0 0 33 40' aria-hidden='true' focusable='false'
path fill='currentColor' d='M0 0h13l20 20-20 20H0l20-20z'
7 changes: 2 additions & 5 deletions app/views/home/_hero.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
p.govuk-body-l
= t('home.hero')

= govuk_button_link_to course_overview_path, class: 'govuk-button--start govuk-!-margin-bottom-4' do
= link_to course_overview_path, class: 'govuk-!-margin-bottom-4 govuk-link--no-visited-state govuk-!-font-weight-bold govuk-body' do
- if current_user
| Learn more
- else
| Learn more and enrol
| Learn more about this training
p.govuk-visually-hidden on the course

svg.govuk-button__start-icon xmlns='http://www.w3.org/2000/svg' width='17.5' height='19' viewBox='0 0 33 40' aria-hidden='true' focusable='false'
path fill='currentColor' d='M0 0h13l20 20-20 20H0l20-20z'

.govuk-grid-column-one-third class='govuk-!-text-align-right'
= m('home.thumb')
17 changes: 7 additions & 10 deletions app/views/home/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,17 @@
.govuk-grid-column-one-half
= m('home.about', headings_start_with: 'xl')

- unless current_user
.govuk-grid-column-one-half
.light-grey-box.enrol-box
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are .enrol-box and .white-space-pre-wrap being used elsewhere or can they also be deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, deleted now

= m('home.login', headings_start_with: 'xl')

.govuk-button-group
= govuk_button_link_to 'Sign in', new_user_session_path
.white-space-pre-wrap= ' or '
= govuk_link_to 'create an account', new_user_registration_path

.prompt.prompt-home
.govuk-grid-row
.govuk-grid-column-one-quarter
i.fa-2x.fa-solid.fa-circle-info aria-describedby='info icon'

.govuk-grid-column-three-quarters
= m('home.prompt', headings_start_with: 'xl')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure of the syntax here but your HTML contains an empty div that is adding spacing. For cleanliness it needs removing -
image

The button at the bottom should be in the grid as follows:
<div class="govuk-!-margin-top-9 govuk-grid-row"><div class="govuk-grid-column-full"><a data-module="govuk-button" draggable="false" role="button" class="govuk-button govuk-button--start" href="/gov-one/info">Start your training now<svg aria-hidden="true" class="govuk-button__start-icon" focusable="false" height="19" viewBox="0 0 33 40" width="17.5" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h13l20 20-20 20H0l20-20z" fill="currentColor"></path></svg></a></div></div>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks there was a div left over from the old design that I hadn't deleted

- unless current_user
.govuk-grid-row class="govuk-!-margin-top-9"
.govuk-grid-column-full
= govuk_button_link_to gov_one_info_path, class: "govuk-button--start" do
| #{t('home.gov_one_button')}
= render 'chevron'
5 changes: 5 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def maintenance?
Types::Params::Bool[ENV.fetch('MAINTENANCE', false)]
end

# @return [Boolean]
def gov_one_login?
Types::Params::Bool[ENV.fetch('GOV_ONE_LOGIN', false)]
end

# @return [ActiveSupport::TimeWithZone]
def public_beta_launch_date
Time.zone.local(2023, 2, 9, 15, 0, 0)
Expand Down
12 changes: 9 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ en:
## Return to your training

Sign in to continue learning, see your progress and download certificates.
gov_one_button: Start your training now

# /about-training
about:
Expand Down Expand Up @@ -577,9 +578,14 @@ en:
# /gov-one/info
gov_one_info:
title: Gov One Info
body: This is some information about Gov One Login.
sign_in_button: Continue to GOV.UK One Login
sign_out_button: Sign out of Gov One Login
hero:
header: How to access this training course
body: This service uses GOV.UK One Login which is managed by the Government Digital Service.
body: You will be asked to sign in to your account, or create a One Login account, in this service
button:
sign_in: Continue to GOV.UK One Login
details_summary: How to access an existing training account
details_text: If you have an existing early years child development training account but you do not yet have a GOV.UK One Login, you must use the same email address for both accounts. This will ensure that any progress you have made through the training is retained.

# /settings/cookie-policy
cookie_policy:
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

get 'my-modules', to: 'learning#show' # @see User#course
get 'about-training', to: 'training/modules#index', as: :course_overview
get 'gov-one/info', to: 'gov_one#info'
get 'gov-one/info', to: 'gov_one#show'

get '/404', to: 'errors#not_found', via: :all
get '/422', to: 'errors#unprocessable_entity', via: :all
Expand Down
10 changes: 0 additions & 10 deletions spec/helpers/gov_one_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,4 @@
expect(login_button).to include 'href="https://oidc.test.account.gov.uk/authorize?redirect_uri=http%3A%2F%2Frecovery.app%2Fusers%2Fauth%2Fopenid_connect%2Fcallback&amp;client_id=some_client_id&amp;response_type=code&amp;scope=email+openid&amp;nonce='
end
end

describe '#logout_button' do
subject(:logout_button) { helper.logout_button }

it 'returns a button link to the gov one logout uri' do
expect(logout_button).to include 'govuk-button'
expect(logout_button).to include 'Sign out of Gov One Login'
expect(logout_button).to include 'href="https://oidc.test.account.gov.uk/logout?post_logout_redirect_uri=http%3A%2F%2Frecovery.app%2Fusers%2Fsign_out&amp;id_token_hint&amp;state='
end
end
end
2 changes: 1 addition & 1 deletion spec/lib/seed_snippets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
subject(:locales) { described_class.new.call }

it 'converts all translations' do
expect(locales.count).to be 191
expect(locales.count).to be 195
end

it 'dot separated key -> Page::Resource#name' do
Expand Down
8 changes: 4 additions & 4 deletions spec/system/front_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
it 'logged in content' do
visit '/'
expect(page).to have_text 'Learn more'
expect(page).not_to have_text 'Learn more and enrol'
expect(page).not_to have_text 'Sign in to continue learning'
expect(page).not_to have_text 'Learn more about this training'
expect(page).not_to have_text 'Start your training now'
end
end

context 'with an unauthenticated visitor' do
it 'log in content' do
visit '/'
expect(page).to have_text('Learn more and enrol')
.and have_text('Sign in to continue learning')
expect(page).to have_text('Learn more about this training')
.and have_text('Start your training now')
end
end
end
25 changes: 25 additions & 0 deletions spec/system/gov_one_info_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'rails_helper'

RSpec.describe 'Gov One Info' do
before do
allow(Rails.application).to receive(:gov_one_login?).and_return(false)
visit '/gov-one/info'
end

context 'with an unauthenticated visitor' do
it 'displays the correct content' do
expect(page).to have_css('h1', text: 'How to access this training course')
expect(page).to have_css('p', text: 'This service uses GOV.UK One Login which is managed by the Government Digital Service.')
expect(page).to have_css('p', text: 'You will be asked to sign in to your account, or create a One Login account, in this service')
expect(page).to have_css('a', text: 'Continue to GOV.UK One Login')
end
end

context 'with an authenticated user' do
include_context 'with user'

it 'redirects to the my modules page' do
expect(page).to have_current_path('/my-modules')
end
end
end
Loading