diff --git a/app/components/copy_of_answers_check_component/view.html.erb b/app/components/copy_of_answers_check_component/view.html.erb new file mode 100644 index 000000000..030415f9f --- /dev/null +++ b/app/components/copy_of_answers_check_component/view.html.erb @@ -0,0 +1,13 @@ +
+
+ <% if title? %> +

<%= t('form.check_your_answers.does_not_want_copy_of_answers_title') %>

+ <% end %> + <% if rows %> + <%= govuk_summary_list(rows: rows) %> + <% else %> +
<%= t('form.check_your_answers.wants_copy_of_answers') + confirmation_email_address %>
+ <% end %> +
+
+ diff --git a/app/components/copy_of_answers_check_component/view.rb b/app/components/copy_of_answers_check_component/view.rb new file mode 100644 index 000000000..8bf5c5d16 --- /dev/null +++ b/app/components/copy_of_answers_check_component/view.rb @@ -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 diff --git a/app/lib/flow/context.rb b/app/lib/flow/context.rb index b3dd1ceda..b948b332f 100644 --- a/app/lib/flow/context.rb +++ b/app/lib/flow/context.rb @@ -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 @@ -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 diff --git a/app/views/forms/check_your_answers/show.html.erb b/app/views/forms/check_your_answers/show.html.erb index 2093a4a39..488743163 100644 --- a/app/views/forms/check_your_answers/show.html.erb +++ b/app/views/forms/check_your_answers/show.html.erb @@ -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 %> +
<%= form.govuk_radio_buttons_fieldset(:send_confirmation, legend: { size: 'm', tag: 'h2' }) do %> diff --git a/app/views/forms/continue_to_one_login/show.html.erb b/app/views/forms/continue_to_one_login/show.html.erb index b9aa24a57..1f6ebb841 100644 --- a/app/views/forms/continue_to_one_login/show.html.erb +++ b/app/views/forms/continue_to_one_login/show.html.erb @@ -8,7 +8,7 @@

<%= t('.title') %>

-

<%= t('.body') %>

+ <%= t('.body_html') %> <%= govuk_button_to( t(".continue_button"), diff --git a/app/views/forms/submitted/submitted.html.erb b/app/views/forms/submitted/submitted.html.erb index aaabe62bf..0cfdddae5 100644 --- a/app/views/forms/submitted/submitted.html.erb +++ b/app/views/forms/submitted/submitted.html.erb @@ -8,6 +8,10 @@

<%= t('form.submitted.email_sent') %>

<% end %> + <% if @current_context.confirmation_details_store.wants_copy_of_answers? %> +

<%= t('form.submitted.copy_of_answers') %>

+ <% end %> + <%if @current_context.form.what_happens_next_markdown.present? %>

<%= t('form.submitted.what_happens_next') %>

<%= HtmlMarkdownSanitizer.new.render_scrubbed_markdown(@current_context.form.what_happens_next_markdown) %> diff --git a/config/locales/cy.yml b/config/locales/cy.yml index 93bd2e3c5..f5e7587b6 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -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 o’ch atebion email_confirmation_input: attributes: confirmation_email_address: @@ -298,10 +298,10 @@ cy: errors: auth_error: body_html: | -

We could not confirm your email address using GOV.UK One Login.

-

You’ll need to go back to the form and submit your answers.

-

Back to form

- title: Sorry, something has gone wrong +

Nid oeddem yn gallu cadarnhau eich cyfeiriad e-bost gan ddefnyddio GOV.UK One Login.

+

Bydd angen i chi fynd yn ôl i’r ffurflen a chyflwyno’ch atebion.

+

Yn ôl i’r ffurflen

+ 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: | @@ -337,9 +337,9 @@ cy: title: Er lles eich diogelwch, rydyn ni wedi dileu’ch atebion return_from_one_login_session_missing: body_html: | -

We could not confirm your email address using GOV.UK One Login.

-

You’ll need to go back to the form and submit your answers - try clicking the ‘Back’ button in your browser.

- title: Sorry, something has gone wrong +

Nid oeddem yn gallu cadarnhau eich cyfeiriad e-bost gan ddefnyddio GOV.UK One Login.

+

Bydd angen i chi fynd yn ôl i’r ffurflen a chyflwyno’ch atebion - ceisiwch glicio ar y botwm ’Yn ôl’ yn eich porwr.

+ 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. @@ -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 @@ -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: | +

Bydd yr e-bost gyda’ch atebion yn cael ei anfon i’r cyfeiriad e-bost sy’n gysylltiedig â’ch GOV.UK One Login.

+

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.

+ 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 @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index b16b5aeec..603a6c11d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 @@ -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: | +

The email with your answers will be sent to the email address linked to your GOV.UK One Login.

+

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.

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: