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

Add sections to routes wizard completed page #4490

Merged
merged 25 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d02756a
WIP routes wizard logic
spencerldixon Dec 17, 2024
b394579
Completed matching logic for each route into teaching
spencerldixon Dec 17, 2024
86a4e2f
Lint and exclude from orphan variables check
spencerldixon Dec 17, 2024
6f91d38
Ammend logic to support multiple answers to a question
spencerldixon Jan 6, 2025
3b7c2b8
WIP move logic to routes class
spencerldixon Jan 7, 2025
612dc4c
WIP adding tests
spencerldixon Jan 7, 2025
d08fccd
WIP adding tests
spencerldixon Jan 7, 2025
d373266
Merge branch 'feature/routes_wizard' into feature/routes_wizard_logic
spencerldixon Jan 10, 2025
982294e
Add results box component
spencerldixon Jan 10, 2025
f07cc6d
Add basic layout to completed page and add results boxes
spencerldixon Jan 10, 2025
e99fd58
Remove substitute values from most fields in results box
spencerldixon Jan 10, 2025
1ad108c
Amend routes mapping
spencerldixon Jan 15, 2025
69e4e3f
Added not yet answers for routes mapping
spencerldixon Jan 15, 2025
cfec5b0
WIP adding page layout
spencerldixon Jan 15, 2025
3de0e39
Merge branch 'feature/routes_wizard' into feature/routes_wizard_layout
spencerldixon Jan 15, 2025
c7a45c0
Added mailing list form component
spencerldixon Jan 15, 2025
8cf0ec6
Change case-when to hash to satisfy rubocop
spencerldixon Jan 15, 2025
831eb76
Swap order of privacy policy and next step button
spencerldixon Jan 15, 2025
d4fbd6a
Improve error messaging and spacing of results cards
spencerldixon Jan 16, 2025
c38df1b
Add start page and extra spacing to bottom of mailer form submit button
spencerldixon Jan 17, 2025
faa98ec
Linting
spencerldixon Jan 17, 2025
aa1de23
Update app/views/routes_into_teaching/steps/completed.html.erb
spencerldixon Jan 20, 2025
cc57754
Stylelint fixes to results box css
spencerldixon Jan 20, 2025
618a3f6
Added default heading tag to QuoteWithImageComponent and changed Resu…
spencerldixon Jan 20, 2025
4f00e08
Fix renaming of quote with image component attribute
spencerldixon Jan 20, 2025
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/components/content/quote_with_image_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<div class="quote-with-image">
<div class="quote-with-image__content-container <%= background_color %>">
<div class="quote-with-image__title <%= heading_color %>"><%= title %></div>
<div class="quote-with-image__title <%= heading_color %>">
<%= content_tag heading_tag do %>
<%= title %>
<% end %>
</div>
<div class="quote-with-image__content <%= "quote-with-image__content--with-quotes" if quotes %> <%= heading_color %>">
<%== text %>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/components/content/quote_with_image_component.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module Content
class QuoteWithImageComponent < ViewComponent::Base
attr_reader :title, :text, :image_path, :heading, :heading_color, :quotes, :background_color
attr_reader :title, :text, :image_path, :heading_tag, :heading_color, :quotes, :background_color

def initialize(title:, text:, image_path: nil, heading: :m, heading_color: "pink", background_color: "blue", quotes: true)
def initialize(title:, text:, image_path: nil, heading_tag: "h3", heading_color: "pink", background_color: "blue", quotes: true)
super

@title = title
@text = text
@image_path = image_path
@heading = heading
@heading_tag = heading_tag
@heading_color = heading_color
@quotes = quotes
@background_color = background_color
Expand Down
4 changes: 2 additions & 2 deletions app/components/content/results_box_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</div>
<% end %>
<section class="results-box results-box--<%= border_color %>">
<h2 class="results-box__heading">
<h3 class="results-box__heading">
<%= heading %>
</h2>
</h3>
<div class="results-box__course-info-container results-box__text">
<div class="results-box__info-row">
<div class="results-box__label">Course fee</div>
Expand Down
25 changes: 22 additions & 3 deletions app/controllers/routes_into_teaching/steps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@ class StepsController < ApplicationController
include GITWizard::Controller
self.wizard_class = RoutesIntoTeaching::Wizard

before_action :set_page_title
before_action :set_step_page_title, only: %i[show update]
before_action :noindex, if: :noindex?
before_action :set_breadcrumb

layout :resolve_layout

def index
end

def completed
policy_id = params[:id]

@privacy_policy = if policy_id
GetIntoTeachingApiClient::PrivacyPoliciesApi.new.get_privacy_policy(policy_id)
else
GetIntoTeachingApiClient::PrivacyPoliciesApi.new.get_latest_privacy_policy
end

@results = RoutesIntoTeaching::Routes.recommended(session[:routes_into_teaching])
end

Expand Down Expand Up @@ -42,16 +55,22 @@ def crm_store
session[:routes_into_teaching] ||= {}
end

def set_step_page_title
@page_title = "Routes into Teaching"
def set_page_title
@page_title = "Find your route into teaching"
end

def set_breadcrumb
breadcrumb @page_title, request.path
end

def set_step_page_title
if @current_step&.title
@page_title += ", #{@current_step.title.downcase} step"
end
end

def resolve_layout
action_name == "completed" ? "minimal" : "registration"
%w[completed index].include?(action_name) ? "minimal" : "registration"
end
end
end
31 changes: 31 additions & 0 deletions app/helpers/routes_into_teaching_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module RoutesIntoTeachingHelper
def answers
session[:routes_into_teaching]
end

def undergraduate_degree_summary
{
"Yes" => "have a degree",
"No" => "do not have a degree",
"Not yet" => "are studying for a degree",
}[answers["undergraduate_degree"]]
end

def unqualified_teacher_summary
{
"Yes" => "have previously worked in a school",
"No" => "haven't previously worked in a school",
}[answers["unqualified_teacher"]]
end

def location_summary
{
"Yes" => "live in England",
"No" => "do not live in England",
}[answers["location"]]
end

def non_uk?
answers["location"] == "No"
end
end
2 changes: 1 addition & 1 deletion app/models/routes_into_teaching/steps/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module RoutesIntoTeaching::Steps
class Location < GITWizard::Step
attribute :location

validates :location, presence: true
validates :location, presence: { message: RoutesIntoTeaching::Wizard::DEFAULT_ERROR_MESSAGE }

def seen?
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module RoutesIntoTeaching::Steps
class UndergraduateDegree < GITWizard::Step
attribute :undergraduate_degree

validates :undergraduate_degree, presence: true
validates :undergraduate_degree, presence: { message: RoutesIntoTeaching::Wizard::DEFAULT_ERROR_MESSAGE }

def options
option_struct = Struct.new(:answer, :text, keyword_init: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module RoutesIntoTeaching::Steps
class UnqualifiedTeacher < GITWizard::Step
attribute :unqualified_teacher

validates :unqualified_teacher, presence: true
validates :unqualified_teacher, presence: { message: RoutesIntoTeaching::Wizard::DEFAULT_ERROR_MESSAGE }

def seen?
false
Expand Down
2 changes: 2 additions & 0 deletions app/models/routes_into_teaching/wizard.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module RoutesIntoTeaching
class Wizard < ::GITWizard::Base
DEFAULT_ERROR_MESSAGE = "Choose an option from the list".freeze

self.steps = [
Steps::UndergraduateDegree,
Steps::UnqualifiedTeacher,
Expand Down
101 changes: 89 additions & 12 deletions app/views/routes_into_teaching/steps/completed.html.erb
Original file line number Diff line number Diff line change
@@ -1,28 +1,105 @@
<%= render Content::LandingHeroComponent.new(
title: "Routes into teaching",
title: "Find your route into teaching",
colour: "pastel yellow-yellow",
) %>

<section class="container">
<div class="row">
<h2>You told us that you:</h2>
<div class="row inset">
<div class="col col-845">
<h2>You told us that you:</h2>

<p>You can <%= link_to "change your answers", routes_into_teaching_steps_path %> if you need to.</p>
<ul>
<li><%= undergraduate_degree_summary %></li>
<li><%= unqualified_teacher_summary %></li>
<li><%= location_summary %></li>
</ul>

<% if non_uk? %>
<%= render Content::ExpanderComponent.new(
title: "visa sponsorship",
text: "<p>If you do not have the right to study or work in the UK, you will need a visa. Your visa will need to be sponsored by a course provider.</p>
<p><a href=\"/non-uk-teachers/visas-for-non-uk-trainees\">Learn more about applying for your visa to train to teach in England</a>.</p>",
) %>
<% end %>

<p>You can <%= link_to "change your answers", routes_into_teaching_steps_path %> if you need to.</p>
</div>
</div>

<div class="row">
<% @results.each do |result| %>
<div class="col-space-s">
<%= render Content::ResultsBoxComponent.new(
<div class="row inset">
<div class="col col-845">
<h2 class="heading--box-blue">Your options</h2>
<p>Based on your answers, you may be eligible for the following teacher training options:</p>
</div>
</div>

<div class="row inset">
<div class="col col-845">
<% @results.each do |result| %>
<div class="col-space-s">
<%= render Content::ResultsBoxComponent.new(
heading: result["title"],
spencerldixon marked this conversation as resolved.
Show resolved Hide resolved
fee: result["course_fee"],
course_length: result["course_length"],
funding: result["funding"],
text: result["description"],
link_text: "Find out more",
link_target: "/steps-to-become-a-teacher",
link_text: result["cta_text"],
link_target: result["cta_link"],
) %>
</div>
<% end %>
</div>
<% end %>
</div>
</div>

<div class="row inset">
<div class="col col-845">
<h2 class="heading--box-blue">Next steps</h2>

<%= render CallsToAction::SimpleComponent.new(icon: "icon-arrow-black") do %>
<h3 class="call-to-action__heading">Get personalised guidance</h3>
<p>Everything you need to know to start a career in teaching sent straight into your inbox. Tailored to your own situation, you'll get all the latest information as well as advice and support.</p>

<div class="row col-space-m">
<%= form_with builder: GOVUKDesignSystemFormBuilder::FormBuilder, url: mailing_list_step_path(:name), scope: :mailing_list_steps_name, method: :put do |f| %>
<%= f.govuk_text_field :first_name, autocomplete: "given-name" %>
<%= f.govuk_text_field :last_name, autocomplete: "family-name" %>
<%= f.govuk_email_field :email, autocomplete: "email" %>
<%= f.hidden_field :channel_id, value: params[:channel] || f.object&.channel_id.presence %>
<%= f.hidden_field :sub_channel_id, value: params[:sub_channel] || f.object&.sub_channel_id.presence %>
<%= f.hidden_field :accepted_policy_id, value: @privacy_policy.id %>
<div class="row col-space-s col-space-s-top">
<small>
Your details are protected under the terms of our <%= link_to("privacy notice (opens in new tab)", "/privacy-policy", { class: "link--black", target: :blank }) %>. This explains how we use your personal data. It's important you read it before signing up to receive emails.
</small>
</div>
<%= f.button "Next step", class: "button", data: { "prevent-double-click": true, "disable-with": "Next step" } %>
<% end %>
</div>
<% end %>
</div>
</div>
</section>

<div class="row">
<div class="col-space-l-top">
<% if non_uk? %>
<%= render Content::QuoteWithImageComponent.new(
title: "Teaching as a non-uk...",
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to have a heading level attributed to it @spencerldixon

I think it should be an h3 as it comes under the h2 of Next steps?

Copy link
Contributor

Choose a reason for hiding this comment

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

However, looking in production, this component does not have a heading eg on https://getintoteaching.education.gov.uk/life-as-a-teacher/teaching-as-a-career/career-progression so I'm presuming we would need to look at this separately?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've changed QuoteWithImageComponent to render a h3 by default, but I've set this as an option, so we can always override this with another value if needed elsewhere

text: "<p>Visit the non-uk section...</p><p><a href=\"/non-uk-teachers\">Read about becoming a teacher as a non-uk citizen</a></p>",
quotes: false,
background_color: "pink",
heading_color: "green",
image_path: "static/images/content/hero-images/0034.jpg"
) %>
<% else %>
<%= render Content::QuoteWithImageComponent.new(
title: "Teacher training stories",
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to have a heading level attributed to it @spencerldixon

I think it should be an h3 as it comes under the h2 of Next steps?

text: "<p>\"My influence and decisions are ultimately impacting on our pupils' lives and the experience that they have at school.\"</p><p><a href=\"/life-as-a-teacher/teaching-as-a-career/abigails-career-progression-story\">Read Abigail's career progression story</a>.</p>",
quotes: true,
background_color: "blue",
heading_color: "pink",
image_path: "static/images/content/case-studies/abigail.jpg"
) %>
<% end %>
</div>
</div>
10 changes: 10 additions & 0 deletions app/views/routes_into_teaching/steps/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%= render Content::LandingHeroComponent.new(
title: "Find your route into teaching",
colour: "pastel yellow-yellow",
) %>

<section class="container">
<div class="row">
<%= link_to "Find your route into teaching", routes_into_teaching_step_path(RoutesIntoTeaching::Wizard.steps.first.key) %>
</div>
</section>
23 changes: 12 additions & 11 deletions app/webpacker/styles/components/results-box.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.results-box {
background: $white;
color: $white;
padding: 1em 0;

&--yellow {
border: 2px solid $yellow;
Expand All @@ -17,9 +18,9 @@

&__title {
background: $yellow;
color: $black;
color: $black;
font-weight: bolder;
display: inline-block;
display: inline-block;
padding: 0.25em 0.5em;
}

Expand All @@ -43,18 +44,18 @@

&__info-row {
display: flex;
justify-content: flex-start;
align-items: flex-start;
justify-content: flex-start;
align-items: flex-start;
}

&__label {
flex: 1;
flex: 1;
text-align: left;
font-weight: bold;
}

&__value {
flex: 2;
flex: 2;
text-align: left;
}

Expand Down Expand Up @@ -84,17 +85,17 @@
@include mq($until: tablet) {
.results-box__info-row {
flex-direction: column;
align-items: flex-start;
align-items: flex-start;
}

.results-box__label,
.results-box__value {
flex: none;
width: 100%;
flex: none;
width: 100%;
}

.results-box__label {
margin-bottom: 0.25rem;
margin-bottom: 0.25rem;
}
}
}
8 changes: 8 additions & 0 deletions app/webpacker/styles/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,18 @@ section.container {
margin-bottom: 1 * $indent-amount;
}

.col-space-s-top {
margin-top: 1 * $indent-amount;
}

.col-space-m {
margin-bottom: 2 * $indent-amount;
}

.col-space-m-top {
margin-top: 2 * $indent-amount;
}

.col-space-l {
margin-bottom: 3 * $indent-amount;
}
Expand Down
Loading
Loading