Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions app/components/copy_of_answers_check_component/view.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="govuk-grid-row">
<div class="<%= full_width? ? 'govuk-grid-column-full' : 'govuk-grid-column-two-thirds-from-desktop' %>">
<% if title? %>
<h2 class="govuk-heading-m govuk-!-margin-top-7"><%= t('form.check_your_answers.does_not_want_copy_of_answers_title') %></h2>
<% end %>
<% if rows %>
<%= govuk_summary_list(rows: rows) %>
<% else %>
<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>
<% end %>
</div>
</div>

36 changes: 36 additions & 0 deletions app/components/copy_of_answers_check_component/view.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module CopyOfAnswersCheckComponent
class View < ApplicationComponent
def initialize(form:, steps:, confirmation_details_store:)
@form = form
@steps = steps
@confirmation_details_store = confirmation_details_store
@wants_copy_of_answers = confirmation_details_store.wants_copy_of_answers?
super()
end

def rows
unless @wants_copy_of_answers
[{
key: { text: helpers.sanitize(I18n.t("form.check_your_answers.does_not_want_copy_of_answers_key")) },
value: { text: helpers.sanitize(I18n.t("form.check_your_answers.does_not_want_copy_of_answers_value")) },
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") }],
}]
end
end

def confirmation_email_address
if @confirmation_details_store.try(:get_copy_of_answers_email_address).present?
@confirmation_details_store.get_copy_of_answers_email_address
end
end

def title?
!@confirmation_details_store.wants_copy_of_answers?
end

def full_width?
# this is to keep this section the same width as the check your answers component
@steps.any? { |step| step.question.has_long_answer? }
end
end
end
4 changes: 2 additions & 2 deletions app/lib/flow/context.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Flow
class Context
attr_reader :form, :journey
attr_reader :form, :journey, :confirmation_details_store

def initialize(form:, form_document:, store:)
@form = form
Expand Down Expand Up @@ -31,6 +31,6 @@ def save_step(step, locale: :en, context: nil)

private

attr_reader :answer_store, :confirmation_details_store
attr_reader :answer_store
end
end
4 changes: 4 additions & 0 deletions app/views/forms/check_your_answers/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

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

<% unless @current_context.confirmation_details_store.wants_copy_of_answers?.nil? %>
<%= render CopyOfAnswersCheckComponent::View.new(form: @form, steps: @steps, confirmation_details_store: @current_context.confirmation_details_store) %>
<% end %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<%= form.govuk_radio_buttons_fieldset(:send_confirmation, legend: { size: 'm', tag: 'h2' }) do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/forms/continue_to_one_login/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l"><%= t('.title') %></h1>

<p><%= t('.body') %></p>
<%= t('.body_html') %>

<%= govuk_button_to(
t(".continue_button"),
Expand Down
4 changes: 4 additions & 0 deletions app/views/forms/submitted/submitted.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<p><%= t('form.submitted.email_sent') %></p>
<% end %>

<% if @current_context.confirmation_details_store.wants_copy_of_answers? %>
<p><%= t('form.submitted.copy_of_answers') %></p>
<% end %>

<%if @current_context.form.what_happens_next_markdown.present? %>
<h2 class="govuk-heading-m"><%= t('form.submitted.what_happens_next') %></h2>
<%= HtmlMarkdownSanitizer.new.render_scrubbed_markdown(@current_context.form.what_happens_next_markdown) %>
Expand Down
37 changes: 22 additions & 15 deletions config/locales/cy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ cy:
copy_of_answers_input:
attributes:
copy_of_answers:
blank: PLACEHOLDER! Dewiswch ydw os hoffech dderbyn copi o'ch atebion
blank: Dewiswch 'Ydw' os ydych eisiau copi och atebion
email_confirmation_input:
attributes:
confirmation_email_address:
Expand Down Expand Up @@ -298,10 +298,10 @@ cy:
errors:
auth_error:
body_html: |
<p>We could not confirm your email address using GOV.UK One Login.</p>
<p>You’ll need to go back to the form and submit your answers.</p>
<p><a href="%{link_url}">Back to form</a></p>
title: Sorry, something has gone wrong
<p>Nid oeddem yn gallu cadarnhau eich cyfeiriad e-bost gan ddefnyddio GOV.UK One Login.</p>
<p>Bydd angen i chi fynd yn ôl i’r ffurflen a chyflwyno’ch atebion.</p>
<p><a href="%{link_url}">Yn ôl i’r ffurflen</a></p>
title: Mae’n ddrwg gennym, mae rhywbeth wedi mynd o’i le
goto_page_routing_error:
cannot_have_goto_page_before_routing_page:
body_html: |
Expand Down Expand Up @@ -337,9 +337,9 @@ cy:
title: Er lles eich diogelwch, rydyn ni wedi dileu’ch atebion
return_from_one_login_session_missing:
body_html: |
<p>We could not confirm your email address using GOV.UK One Login.</p>
<p>You’ll need to go back to the form and submit your answers - try clicking the ‘Back’ button in your browser.</p>
title: Sorry, something has gone wrong
<p>Nid oeddem yn gallu cadarnhau eich cyfeiriad e-bost gan ddefnyddio GOV.UK One Login.</p>
<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>
title: Mae’n ddrwg gennym, mae rhywbeth wedi mynd o’i le
submission_error:
body: |
Roedd yna broblem gyda’r gwasanaeth ac rydyn ni wedi methu cyflwyno’ch atebion.
Expand All @@ -363,11 +363,16 @@ cy:
check_your_answers:
agree_and_submit: Cytuno a chyflwyno
declaration: Datganiad
does_not_want_copy_of_answers_key: Cael copi o’ch atebion
does_not_want_copy_of_answers_title: Rydych wedi dewis peidio â chael copi o’ch atebion
does_not_want_copy_of_answers_value: Na
not_completed: Heb ei gwblhau
submit: Cyflwyno
title: Edrychwch dros eich atebion cyn cyflwyno’ch ffurflen
wants_copy_of_answers: 'Byddwn yn anfon e-bost cadarnhau gyda chopi o’ch atebion i’ch cyfeiriad e-bost GOV.UK One Login: '
submitted:
continue_to_pay: Parhau i dalu
copy_of_answers: Rydym wedi anfon e-bost cadarnhau atoch gyda chopi o'ch atebion.
email_sent: Rydym wedi anfon e-bost cadarnhau atoch.
need_to_pay: Mae angen i chi dalu o hyd
title: Mae eich ffurflen wedi’i chyflwyno
Expand Down Expand Up @@ -395,14 +400,16 @@ cy:
back: Yn ôl
continue_to_one_login:
show:
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.
continue_button: Continue to GOV.UK One Login
title: Use GOV.UK One Login to keep your information secure
body_html: |
<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>
<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>
continue_button: Parhau i GOV.UK One Login
title: Defnyddiwch GOV.UK One Login i gadw’ch gwybodaeth yn ddiogel.
copy_of_answers:
show:
heading: PLACEHOLDER! Ydych chi eisiau copi o'ch atebion?
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.
title: PLACEHOLDER! Ydych chi eisiau copi o'ch atebion?
heading: Ydych chi eisiau cael e-bost gyda chopi o’ch atebion?
hint: Byddwch angen GOV.UK One Login ar gyfer hyn - byddwch yn gallu mewngofnodi neu greu un newydd.
title: Ydych chi eisiau cael e-bost gyda chopi o’ch atebion?
remove_answer:
show:
address_heading: Dileu cyfeiriad
Expand Down Expand Up @@ -677,5 +684,5 @@ cy:
phone: Ffôn
unknown_form_submitted:
show:
email_sent: We’ve sent you a confirmation email with a copy of your answers.
email_sent: Rydym wedi anfon e-bost cadarnhau atoch gyda chopi o’ch atebion.
title: Your form has been submitted
11 changes: 9 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,16 @@ en:
check_your_answers:
agree_and_submit: Agree and submit
declaration: Declaration
does_not_want_copy_of_answers_key: Get a copy of your answers
does_not_want_copy_of_answers_title: You’ve chosen to not get a copy of your answers
does_not_want_copy_of_answers_value: 'No'
not_completed: Not completed
submit: Submit
title: Check your answers before submitting your form
wants_copy_of_answers: 'We’ll send a confirmation email with a copy of your answers to your GOV.UK One Login email address: '
submitted:
continue_to_pay: Continue to pay
copy_of_answers: We’ve sent you a confirmation email with a copy of your answers.
email_sent: We’ve sent you a confirmation email.
need_to_pay: You still need to pay
title: Your form has been submitted
Expand Down Expand Up @@ -395,13 +400,15 @@ en:
back: Back
continue_to_one_login:
show:
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.
body_html: |
<p>The email with your answers will be sent to the email address linked to your GOV.UK One Login.</p>
<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>
continue_button: Continue to GOV.UK One Login
title: Use GOV.UK One Login to keep your information secure
copy_of_answers:
show:
heading: Do you want to get an email with a copy of your answers?
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.
hint: You’ll need a GOV.UK One Login for this - you’ll be able to sign in or create a new one.
title: Do you want a copy of your answers?
remove_answer:
show:
Expand Down
Loading