Skip to content

Commit e0b73f9

Browse files
committed
update and add welsh content for copy of answers
- this includes adding a new component on the check your answers page, which shows whether you have requested a copy of your answers - it also includes an update to the context class, and makes the confirmation_details_store public. This is so we can access the user answers on copy_of_answers.
1 parent 26bb815 commit e0b73f9

8 files changed

Lines changed: 91 additions & 20 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div class="govuk-grid-row">
2+
<div class="<%= full_width? ? 'govuk-grid-column-full' : 'govuk-grid-column-two-thirds-from-desktop' %>">
3+
<% if title? %>
4+
<h2 class="govuk-heading-m govuk-!-margin-top-7"><%= t('form.check_your_answers.does_not_want_copy_of_answers_title') %></h2>
5+
<% end %>
6+
<% if rows %>
7+
<%= govuk_summary_list(rows: rows) %>
8+
<% else %>
9+
<div class="govuk-hint govuk-!-margin-top-5 govuk-!-margin-bottom-7"><%= t('form.check_your_answers.wants_copy_of_answers') + confirmation_email_address %></div>
10+
<% end %>
11+
</div>
12+
</div>
13+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module CopyOfAnswersCheckComponent
2+
class View < ApplicationComponent
3+
def initialize(form:, steps:, confirmation_details_store:)
4+
@form = form
5+
@steps = steps
6+
@confirmation_details_store = confirmation_details_store
7+
@wants_copy_of_answers = confirmation_details_store.wants_copy_of_answers?
8+
super()
9+
end
10+
11+
def rows
12+
unless @wants_copy_of_answers
13+
[{
14+
key: { text: helpers.sanitize(I18n.t("form.check_your_answers.does_not_want_copy_of_answers_key")) },
15+
value: { text: helpers.sanitize(I18n.t("form.check_your_answers.does_not_want_copy_of_answers_value")) },
16+
actions: [{ text: I18n.t("govuk_components.govuk_summary_list.change"), href: "copy-of-answers", visually_hidden_text: I18n.t("govuk_components.govuk_summary_list.change") }],
17+
}]
18+
end
19+
end
20+
21+
def confirmation_email_address
22+
if @confirmation_details_store.try(:get_copy_of_answers_email_address).present?
23+
@confirmation_details_store.get_copy_of_answers_email_address
24+
end
25+
end
26+
27+
def title?
28+
!@confirmation_details_store.wants_copy_of_answers?
29+
end
30+
31+
def full_width?
32+
# this is to keep this section the same width as the check your answers component
33+
@steps.any? { |step| step.question.has_long_answer? }
34+
end
35+
end
36+
end

app/lib/flow/context.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Flow
22
class Context
3-
attr_reader :form, :journey
3+
attr_reader :form, :journey, :confirmation_details_store
44

55
def initialize(form:, form_document:, store:)
66
@form = form
@@ -31,6 +31,6 @@ def save_step(step, locale: :en, context: nil)
3131

3232
private
3333

34-
attr_reader :answer_store, :confirmation_details_store
34+
attr_reader :answer_store
3535
end
3636
end

app/views/forms/check_your_answers/show.html.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
<%= render CheckYourAnswersComponent::View.new(form: @form, steps: @steps, mode: @mode) %>
2121

22+
<% unless @current_context.confirmation_details_store.wants_copy_of_answers?.nil? %>
23+
<%= render CopyOfAnswersCheckComponent::View.new(form: @form, steps: @steps, confirmation_details_store: @current_context.confirmation_details_store) %>
24+
<% end %>
25+
2226
<div class="govuk-grid-row">
2327
<div class="govuk-grid-column-two-thirds-from-desktop">
2428
<%= form.govuk_radio_buttons_fieldset(:send_confirmation, legend: { size: 'm', tag: 'h2' }) do %>

app/views/forms/continue_to_one_login/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="govuk-grid-column-two-thirds">
99
<h1 class="govuk-heading-l"><%= t('.title') %></h1>
1010

11-
<p><%= t('.body') %></p>
11+
<%= t('.body_html') %>
1212

1313
<%= govuk_button_to(
1414
t(".continue_button"),

app/views/forms/submitted/submitted.html.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<p><%= t('form.submitted.email_sent') %></p>
99
<% end %>
1010

11+
<% if @current_context.confirmation_details_store.wants_copy_of_answers? %>
12+
<p><%= t('form.submitted.copy_of_answers') %></p>
13+
<% end %>
14+
1115
<%if @current_context.form.what_happens_next_markdown.present? %>
1216
<h2 class="govuk-heading-m"><%= t('form.submitted.what_happens_next') %></h2>
1317
<%= HtmlMarkdownSanitizer.new.render_scrubbed_markdown(@current_context.form.what_happens_next_markdown) %>

config/locales/cy.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ cy:
8686
copy_of_answers_input:
8787
attributes:
8888
copy_of_answers:
89-
blank: PLACEHOLDER! Dewiswch ydw os hoffech dderbyn copi o'ch atebion
89+
blank: Dewiswch 'Ydw' os ydych eisiau copi och atebion
9090
email_confirmation_input:
9191
attributes:
9292
confirmation_email_address:
@@ -298,10 +298,10 @@ cy:
298298
errors:
299299
auth_error:
300300
body_html: |
301-
<p>We could not confirm your email address using GOV.UK One Login.</p>
302-
<p>You’ll need to go back to the form and submit your answers.</p>
303-
<p><a href="%{link_url}">Back to form</a></p>
304-
title: Sorry, something has gone wrong
301+
<p>Nid oeddem yn gallu cadarnhau eich cyfeiriad e-bost gan ddefnyddio GOV.UK One Login.</p>
302+
<p>Bydd angen i chi fynd yn ôl i’r ffurflen a chyflwyno’ch atebion.</p>
303+
<p><a href="%{link_url}">Yn ôl i’r ffurflen</a></p>
304+
title: Mae’n ddrwg gennym, mae rhywbeth wedi mynd o’i le
305305
goto_page_routing_error:
306306
cannot_have_goto_page_before_routing_page:
307307
body_html: |
@@ -337,9 +337,9 @@ cy:
337337
title: Er lles eich diogelwch, rydyn ni wedi dileu’ch atebion
338338
return_from_one_login_session_missing:
339339
body_html: |
340-
<p>We could not confirm your email address using GOV.UK One Login.</p>
341-
<p>You’ll need to go back to the form and submit your answers - try clicking the ‘Back’ button in your browser.</p>
342-
title: Sorry, something has gone wrong
340+
<p>Nid oeddem yn gallu cadarnhau eich cyfeiriad e-bost gan ddefnyddio GOV.UK One Login.</p>
341+
<p>Bydd angen i chi fynd yn ôl i’r ffurflen a chyflwyno’ch atebion - ceisiwch glicio ar y botwm ’Yn ôl’ yn eich porwr.</p>
342+
title: Mae’n ddrwg gennym, mae rhywbeth wedi mynd o’i le
343343
submission_error:
344344
body: |
345345
Roedd yna broblem gyda’r gwasanaeth ac rydyn ni wedi methu cyflwyno’ch atebion.
@@ -363,11 +363,16 @@ cy:
363363
check_your_answers:
364364
agree_and_submit: Cytuno a chyflwyno
365365
declaration: Datganiad
366+
does_not_want_copy_of_answers_key: Cael copi o’ch atebion
367+
does_not_want_copy_of_answers_title: Rydych wedi dewis peidio â chael copi o’ch atebion
368+
does_not_want_copy_of_answers_value: Na
366369
not_completed: Heb ei gwblhau
367370
submit: Cyflwyno
368371
title: Edrychwch dros eich atebion cyn cyflwyno’ch ffurflen
372+
wants_copy_of_answers: 'Byddwn yn anfon e-bost cadarnhau gyda chopi o’ch atebion i’ch cyfeiriad e-bost GOV.UK One Login: '
369373
submitted:
370374
continue_to_pay: Parhau i dalu
375+
copy_of_answers: Rydym wedi anfon e-bost cadarnhau atoch gyda chopi o'ch atebion.
371376
email_sent: Rydym wedi anfon e-bost cadarnhau atoch.
372377
need_to_pay: Mae angen i chi dalu o hyd
373378
title: Mae eich ffurflen wedi’i chyflwyno
@@ -395,14 +400,16 @@ cy:
395400
back: Yn ôl
396401
continue_to_one_login:
397402
show:
398-
body: To help make sure the information we send you stays secure, you’ll need to sign in to or create a GOV.UK One Login.
399-
continue_button: Continue to GOV.UK One Login
400-
title: Use GOV.UK One Login to keep your information secure
403+
body_html: |
404+
<p>Bydd yr e-bost gyda’ch atebion yn cael ei anfon i’r cyfeiriad e-bost sy’n gysylltiedig â’ch GOV.UK One Login.</p>
405+
<p>Os ydych angen i’r atebion gael eu hanfon i gyfeiriad e-bost gwahanol - er enghraifft, eich e-bost gwaith - gallwch greu GOV.UK One Login newydd.</p>
406+
continue_button: Parhau i GOV.UK One Login
407+
title: Defnyddiwch GOV.UK One Login i gadw’ch gwybodaeth yn ddiogel.
401408
copy_of_answers:
402409
show:
403-
heading: PLACEHOLDER! Ydych chi eisiau copi o'ch atebion?
404-
hint: PLACEHOLDER! Byddwn ond yn defnyddio'r cyfeiriad e-bost rydych yn ei ddarparu yma i anfon cadarnhad bod eich ffurflen wedi'i chyflwyno'n llwyddiannus. Ni fydd yn cynnwys copi o'ch atebion.
405-
title: PLACEHOLDER! Ydych chi eisiau copi o'ch atebion?
410+
heading: Ydych chi eisiau cael e-bost gyda chopi o’ch atebion?
411+
hint: Byddwch angen GOV.UK One Login ar gyfer hyn - byddwch yn gallu mewngofnodi neu greu un newydd.
412+
title: Ydych chi eisiau cael e-bost gyda chopi o’ch atebion?
406413
remove_answer:
407414
show:
408415
address_heading: Dileu cyfeiriad
@@ -677,5 +684,5 @@ cy:
677684
phone: Ffôn
678685
unknown_form_submitted:
679686
show:
680-
email_sent: We’ve sent you a confirmation email with a copy of your answers.
687+
email_sent: Rydym wedi anfon e-bost cadarnhau atoch gyda chopi o’ch atebion.
681688
title: Your form has been submitted

config/locales/en.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,16 @@ en:
363363
check_your_answers:
364364
agree_and_submit: Agree and submit
365365
declaration: Declaration
366+
does_not_want_copy_of_answers_key: Get a copy of your answers
367+
does_not_want_copy_of_answers_title: You’ve chosen to not get a copy of your answers
368+
does_not_want_copy_of_answers_value: 'No'
366369
not_completed: Not completed
367370
submit: Submit
368371
title: Check your answers before submitting your form
372+
wants_copy_of_answers: 'We’ll send a confirmation email with a copy of your answers to your GOV.UK One Login email address: '
369373
submitted:
370374
continue_to_pay: Continue to pay
375+
copy_of_answers: We’ve sent you a confirmation email with a copy of your answers.
371376
email_sent: We’ve sent you a confirmation email.
372377
need_to_pay: You still need to pay
373378
title: Your form has been submitted
@@ -395,13 +400,15 @@ en:
395400
back: Back
396401
continue_to_one_login:
397402
show:
398-
body: To help make sure the information we send you stays secure, you’ll need to sign in to or create a GOV.UK One Login.
403+
body_html: |
404+
<p>The email with your answers will be sent to the email address linked to your GOV.UK One Login.</p>
405+
<p>If you need the answers sent to a different email address - for example, your work email - you can create a new GOV.UK One Login.</p>
399406
continue_button: Continue to GOV.UK One Login
400407
title: Use GOV.UK One Login to keep your information secure
401408
copy_of_answers:
402409
show:
403410
heading: Do you want to get an email with a copy of your answers?
404-
hint: You’ll need a GOV.UK One Login for this - you’ll be able to create one now if you do not already have one.
411+
hint: You’ll need a GOV.UK One Login for this - you’ll be able to sign in or create a new one.
405412
title: Do you want a copy of your answers?
406413
remove_answer:
407414
show:

0 commit comments

Comments
 (0)