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 9 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
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 info
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it is possible to stick to RESTful CRUD actions in this controller at this point in time?

redirect_to my_modules_path if current_user
end
end
8 changes: 4 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_uri, 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_uri, 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: 'gov-one/info', options: { inverse: true })
header.with_navigation_item(text: 'Sign in', href: 'gov-one/info', classes: %w[dfe-header__navigation-item dfe-header-f-mob])
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there not a path helper?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like this? 7b776be

end
end
end
Expand Down
7 changes: 1 addition & 6 deletions app/helpers/gov_one_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ def logout_uri

# @return [String]
def login_button
govuk_button_link_to t('gov_one.links.sign_in'), login_uri
end

# @return [String]
def logout_button
govuk_button_link_to t('gov_one.links.sign_out'), logout_uri
govuk_button_link_to t('gov-one-info.sign-in-button'), login_uri
end

private
Expand Down
31 changes: 22 additions & 9 deletions app/views/gov_one/info.html.slim
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
= render 'learning/cms_debug'

- content_for :page_title do
= html_title t('gov_one.title')
= html_title t('home.title')

- content_for :hero do
.govuk-grid-row class='govuk-!-padding-top-9 govuk-!-padding-bottom-0'
.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-one-half
= m('gov_one.body')
.govuk-grid-column-three-quarters
. class='govuk-!-margin-bottom-5'

Choose a reason for hiding this comment

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

change this to column-full

Copy link
Contributor Author

Choose a reason for hiding this comment

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

= m('gov-one-info.body')
hr

= govuk_button_link_to t('gov-one-info.sign-in-button'), login_uri

- if current_user
= logout_button
- else
= login_button
. class='govuk-!-margin-top-6 govuk-!-margin-bottom-9'
details.govuk-details data-module='govuk-details'
Copy link

@instantrick instantrick Nov 17, 2023

Choose a reason for hiding this comment

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

This needs to be inside a govuk row with a control on the width:

<div class="govuk-grid-row govuk-!-margin-top-4 govuk-!-margin-bottom-9">
    <div class="govuk-grid-column-three-quarters"><details class="govuk-details" data-module="govuk-details"><summary class="govuk-details__summary"><span class="govuk-details__summary-text">How to access an existing training account</span></summary><div class="govuk-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.</div></details></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.

Cheers Rick, my latest changes are in this commit 3b7ba6a

Choose a reason for hiding this comment

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

Change this to margin-top-4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

summary.govuk-details__summary
span.govuk-details__summary-text
= t('gov-one-info.details-summary')
.govuk-details__text
= t('gov-one-info.details-text')

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-button-group
= govuk_button_link_to 'gov-one/info', class: "govuk-button--start" do
| #{t('home.gov-one-button')}
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'
Copy link
Contributor

Choose a reason for hiding this comment

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

Think I'd left a comment in the code about moving this CTA button into a partial. If you can manage it as part of this please do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

path fill='currentColor' d='M0 0h13l20 20-20 20H0l20-20z'
2 changes: 0 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,6 @@ en:
home:
title: Home page
hero: |
# %{service_name}

This free, online training provides an overview of child development and gives practical advice for supporting the development of children in your early years setting.
thumb: |
![A practitioner smiling as they do an activity with children in an early years setting](//images.ctfassets.net/dvmeh832nmjc/2VRBZCHJYLeKx0a2CIcJzE/687fb0d28c71104820cd42f131d7dfe2/_assets_thumb-1161068272-320x240.jpg?fit=scale&w=380)
Expand Down
12 changes: 1 addition & 11 deletions spec/helpers/gov_one_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,8 @@

it 'returns a button link to the gov one login uri' do
expect(login_button).to include 'govuk-button'
expect(login_button).to include 'Sign in with Gov One Login'
expect(login_button).to include 'Continue to GOV.UK One Login'
expect(login_button).to include 'href="https://oidc.test.account.gov.uk/authorize?response_type=code&amp;scope=email+openid&amp;client_id=some_client_id&'
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?id_token_hint&amp;state='
end
end
end
31 changes: 31 additions & 0 deletions spec/system/gov_one_info_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'rails_helper'

RSpec.describe 'Gov One Info' do
context 'when the user is not logged in' do
before do
visit '/gov-one/info'
end

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

it 'has the correct login link' do
link = find_link('Continue to GOV.UK One Login')
Copy link
Contributor

Choose a reason for hiding this comment

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

If this complex link is asserted elsewhere I'd favour a simpler, more readable, spec.

expect(link[:href]).to start_with('https://oidc.test.account.gov.uk/authorize?response_type=code&scope=email+openid&client_id=some_client_id')
expect(link[:href]).to end_with('&redirect_uri=http%3A%2F%2Frecovery.app%2Fusers%2Fauth%2Fopenid_connect%2Fcallback')
end
end

context 'when the user is logged in' do
include_context 'with user'

it 'they are redirected to the my modules page' do
visit '/gov-one/info'
expect(page).to have_current_path('/my-modules')
end
end
end
22 changes: 12 additions & 10 deletions spec/system/whats_new_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@
end

describe 'with subsequent logins' do
before do
click_on 'sign-out-desktop'
skip 'wip' do
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is skipping necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed 948fa98

before do
click_on 'sign-out-desktop'

visit '/users/sign-in'
fill_in 'Email address', with: user.email
fill_in 'Password', with: user.password
click_button 'Sign in'
end
visit '/users/sign-in'
fill_in 'Email address', with: user.email
fill_in 'Password', with: user.password
click_button 'Sign in'
end

it 'does not appear' do
expect(page).not_to have_current_path '/whats-new'
expect(page).to have_current_path '/my-modules'
it 'does not appear' do
expect(page).not_to have_current_path '/whats-new'
expect(page).to have_current_path '/my-modules'
end
end
end
end
Expand Down
Loading