Skip to content

Commit

Permalink
Merge pull request #363 from DFE-Digital/apply-2-pages
Browse files Browse the repository at this point in the history
First pass at tweaks to the application for Apply 2
  • Loading branch information
fofr committed Mar 18, 2020
2 parents 2e58a83 + 0b771a4 commit 5bc5129
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 20 deletions.
4 changes: 4 additions & 0 deletions app/data/dummy-apply-2-application.js
Expand Up @@ -11,4 +11,8 @@ dummyApply2Application.completed = {}
// No choices yet
dummyApply2Application.choices = {}

// References received
dummyApply2Application.referees.first.status = 'Received'
dummyApply2Application.referees.second.status = 'Received'

module.exports = dummyApply2Application
14 changes: 12 additions & 2 deletions app/routes/application.js
Expand Up @@ -155,8 +155,10 @@ module.exports = router => {

// Render application page
router.all('/application/:applicationId', (req, res) => {
const showCopiedBanner = req.query.copied

req.session.data.applications[req.params.applicationId].welcomeFlow = false
res.render('application/index')
res.render('application/index', { showCopiedBanner })
})

// Generate apply2 application from an existing one
Expand All @@ -173,9 +175,17 @@ module.exports = router => {
apply2Application.completed = {}
apply2Application.previousApplications = [existingApplicationId]

if (apply2Application.referees && apply2Application.referees.first) {
apply2Application.referees.first.status = 'Received'
}

if (apply2Application.referees && apply2Application.referees.second) {
apply2Application.referees.second.status = 'Received'
}

data.applications[code] = apply2Application

res.redirect(`/application/${code}`)
res.redirect(`/application/${code}?copied=true`)
})

// Render submitted page
Expand Down
2 changes: 1 addition & 1 deletion app/routes/application/choices.js
Expand Up @@ -132,7 +132,7 @@ module.exports = router => {
const count = Object.keys(applicationData.choices).length
const paths = pickPaths(req)

if (count === 3 || req.body['add-another-course'] === 'no') {
if (count === 3 || applicationData.apply2 || req.body['add-another-course'] === 'no') {
res.redirect(req.params.referrer || paths.next)
} else {
res.render('application/choices/another', {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/application/review.js
Expand Up @@ -12,7 +12,7 @@ module.exports = router => {
if (successFlash[0] === 'submitted-incompleted-application') {
pageObject.errorList = []
const sections = {
choices: 'Course choices not marked as completed',
choices: applicationData.apply2 ? 'Course choice not marked as completed' : 'Course choices not marked as completed',
candidate: 'Personal details not entered',
'contact-details': 'Contact details not entered',
'reasonable-adjustments': 'Training with a disability not entered',
Expand Down
6 changes: 6 additions & 0 deletions app/views/_includes/item/reference.njk
@@ -1,5 +1,11 @@
{% set applicationPath = "/application/" + applicationId %}
{% set status = item.status or "requested" %}

{% if applicationValue('apply2') %}
{% set showReferenceStatus = true %}
{% set canAmend = false %}
{% endif %}

{% set statusHtml %}
{{ govukTag({
classes: "app-tag--" + status,
Expand Down
11 changes: 9 additions & 2 deletions app/views/_includes/need-help.njk
@@ -1,4 +1,11 @@
{% set contentHtml %}
{% if applicationValue('apply2') %}
<p class="govuk-!-font-size-16">
<a href="#">View previous applications</a>
</p>

<h2 class="govuk-heading-s govuk-!-margin-bottom-2" id="help-title">Need help?</h2>
{% endif %}
<ul class="govuk-list govuk-!-font-size-16">
<li>Email: <a class="govuk-link" href="mailto:becomingateacher@digital.education.gov.uk">becomingateacher<wbr>@digital.education.gov.uk</a></li>
<li>Monday to Friday (except public holidays)</li>
Expand All @@ -8,8 +15,8 @@

{{ appRelated({
name: "help",
title: "Need help?",
title: "Previous applications" if applicationValue('apply2') else "Need help?",
content: {
html: contentHtml
}
}) }}
}) }}
20 changes: 14 additions & 6 deletions app/views/_includes/review/references.njk
@@ -1,12 +1,20 @@
{% set complete = references | length > 0 %}
{% if complete %}
{% set canAmend = true if not hasSubmittedApplications() %}
{% if not canAmend %}
<p class="govuk-body">We’ve contacted the referees you provided below. We’ll let you know if they don’t give a reference.</p>
{% else %}
{# You can’t change your referees once application has been submitted #}
<p class="govuk-body">We’ll contact your referees after you submit your application. We’ll let you know if they don’t give a reference.</p>
{% endif %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{% if not canAmend %}
<p class="govuk-body">We’ve contacted the referees you provided below. We’ll let you know if they don’t give a reference.</p>
{% else %}
{% if applicationValue('apply2') %}
<p class="govuk-body">If you replace a referee we will contact them after you submit your application. We’ll let you know if they don’t give a reference.</p>
{% else %}
{# You can’t change your referees once application has been submitted #}
<p class="govuk-body">We’ll contact your referees after you submit your application. We’ll let you know if they don’t give a reference.</p>
{% endif %}
{% endif %}
</div>
</div>
{% set references = references | toArray %}
{% for item in references %}
{% set refereeHtml %}
Expand Down
26 changes: 26 additions & 0 deletions app/views/application/apply-again.njk
@@ -0,0 +1,26 @@
{% extends "_content.njk" %}

{% set title = "Do you want to apply again?" %}

{% block primary %}
<p>Your first application was unsuccessful.</p>

<p>If you apply again we’ll:</p>
<ul class="govuk-list govuk-list--bullet">
<li>copy your application so you don’t need to start again</li>
<li>let you make changes to each section</li>
<li>keep your references so you won’t need to request new ones</li>
</ul>

<p>You can only apply to 1 course at a time at this stage of your application.</p>

<hr class="govuk-section-break govuk-section-break--m">
{{ govukButton({
classes: "govuk-!-margin-bottom-5",
isStartButton: true,
text: "Start now",
href: "/application/" + applicationId + "/apply2"
}) }}
<p class="govuk-body">or</p>
<p class="govuk-body"><a href="/application/{{ applicationId }}">Go to your dashboard</a></p>
{% endblock %}
26 changes: 23 additions & 3 deletions app/views/application/choices/index.njk
Expand Up @@ -6,9 +6,17 @@
{% set choices = applicationValue("choices") | toArray %}
{% set choiceCount = choices | length %}
{% if choiceCount >= 1 %}
{% set title = "Course choices" %}
{% if applicationValue(["apply2"]) %}
{% set title = "Course choice" %}
{% else %}
{% set title = "Course choices" %}
{% endif %}
{% else %}
{% set title = "Choosing courses" %}
{% if applicationValue(["apply2"]) %}
{% set title = "Choosing a course" %}
{% else %}
{% set title = "Choosing courses" %}
{% endif %}
{% endif %}

{% block pageNavigation %}
Expand All @@ -27,6 +35,16 @@
{% endblock %}

{% block primary %}
{% set guidance %}
{% if applicationValue(["apply2"]) %}
<p class="govuk-body">You can only apply to 1 course at a time at this stage of your application.</p>
{% else %}
<p class="govuk-body">You can apply to up to 3 courses at this stage of your application.</p>
{% endif %}
<p class="govuk-body">Not all courses and training providers are signed up to Apply for teacher training. If you choose a course that isn’t signed up to the service, you’ll be directed to UCAS to continue your application.</p>
<p class="govuk-body">You can preview <a href="/apply/providers">courses currently available</a> on Apply for teacher training.</p>
{% endset %}

{% if choices %}
{% set referrer = applicationPath + "/choices" %}
{% set canAmend = true %}
Expand All @@ -36,13 +54,15 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{% if not choices or choiceCount == 0 %}
{{ guidance | safe }}

{{ govukButton({
text: "Continue",
href: applicationPath + "/choices/add"
}) }}
{% endif %}

{% if choiceCount >= 1 and choiceCount < 3 %}
{% if choiceCount >= 1 and choiceCount < 3 and not applicationValue(["apply2"]) %}
{{ govukButton({
classes: "govuk-button--secondary govuk-!-margin-bottom-9",
text: "Add another course",
Expand Down
25 changes: 22 additions & 3 deletions app/views/application/index.njk
Expand Up @@ -2,7 +2,11 @@
{% set applicationPath = "/application/" + applicationId %}
{% set status = applicationValue(["status"]) %}
{% if status == "started" %}
{% set title = "Your application" %}
{% if applicationValue('apply2') %}
{% set title = "Your new application" %}
{% else %}
{% set title = "Your application" %}
{% endif %}
{% set tagClass = "app-tag--completed" %}
{% set tagText = "Completed" %}
{% set reviewText = "Check your answers before submitting" %}
Expand All @@ -14,6 +18,16 @@
{% endif %}
{% set hasSecondary = true %}

{% block beforePageTitle %}
{% if showCopiedBanner %}
{{ appBanner({
html: "<h2 class=\"govuk-heading-m\">We’ve copied your application</h2>",
type: "success",
icon: false
}) }}
{% endif %}
{% endblock %}

{% block pageNavigation %}
{% if hasSubmittedApplications() %}
{{ govukBreadcrumbs({
Expand All @@ -37,11 +51,16 @@
text: "You have 5 days remaining (until " + (7 | nowPlusDays("d MMMM yyyy")) + ") to submit your edited application",
iconFallbackText: "Warning"
}) if status == "amending" }}
<h2 class="govuk-heading-m govuk-!-font-size-27 govuk-!-margin-bottom-2">Course choices</h2>

{% if applicationValue(["apply2"]) %}
<h2 class="govuk-heading-m govuk-!-font-size-27 govuk-!-margin-bottom-2">Course choice</h2>
{% else %}
<h2 class="govuk-heading-m govuk-!-font-size-27 govuk-!-margin-bottom-2">Course choices</h2>
{% endif %}
{{ appTaskList({
classes: "govuk-!-margin-bottom-8",
items: [{
text: "Course choices",
text: "Course choice" if applicationValue(["apply2"]) else "Course choices",
href: applicationPath + "/choices",
id: "personal-details",
tag: {
Expand Down
6 changes: 5 additions & 1 deletion app/views/application/review.njk
Expand Up @@ -28,7 +28,11 @@
text: "Please review your changes carefully before you resubmit. Your application can only be resubmitted once."
}) if status == "amending" }}

<h2 class="govuk-heading-m govuk-!-font-size-27">Courses</h2>
{% if applicationValue(["apply2"]) %}
<h2 class="govuk-heading-m govuk-!-font-size-27 govuk-!-margin-bottom-2">Course</h2>
{% else %}
<h2 class="govuk-heading-m govuk-!-font-size-27 govuk-!-margin-bottom-2">Courses</h2>
{% endif %}
{% set choices = applicationValue(["choices"]) | toArray %}
{% set showChoiceStatus = false %}
{% set showIncomplete = true %}
Expand Down
8 changes: 7 additions & 1 deletion app/views/applications/index.njk
Expand Up @@ -27,7 +27,7 @@

{% block beforePrimary %}

{% set needsReferee = true %}
{% set needsReferee = false %}
{% if needsReferee %}
{# <div class="app-banner">
<h2 class="govuk-heading-m govuk-!-margin-bottom-0" id="success-message">
Expand All @@ -42,6 +42,12 @@
</div>
{% endif %}

<div class="app-banner">
<h2 class="govuk-heading-m govuk-!-margin-bottom-0" id="success-message">
<a href="/application/{{ applicationId }}/apply-again">Do you want to apply again?</a>
</h2>
</div>

{# <div class="app-banner app-banner--success">
<h2 class="govuk-heading-m govuk-!-margin-bottom-0" id="success-message">
Thank you. We’ve asked your new referee for a reference
Expand Down

0 comments on commit 5bc5129

Please sign in to comment.