Skip to content

Commit

Permalink
Move remaining text into locale file
Browse files Browse the repository at this point in the history
Moves the title, timestamp and reference text into the locale file.

Also replaces the quotes around the form title with curly quotes.
  • Loading branch information
DavidBiddle committed Feb 10, 2025
1 parent 65b1ed3 commit 26bc389
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<p>
This is a completed "<%= @mailer_options.title %>" form.
<%= I18n.t("mailer.submission.title", title: @mailer_options.title) %>
</p>
<p>
This form was submitted at <%= @mailer_options.timestamp.strftime("%l:%M%P").strip %> on <%= @mailer_options.timestamp.strftime("%-d %B %Y") %>
<%= I18n.t("mailer.submission.time", time: @mailer_options.timestamp.strftime("%l:%M%P").strip, date: @mailer_options.timestamp.strftime("%-d %B %Y") ) %>
</p>
<p>
GOV.​UK Forms reference number: <%= @mailer_options.submission_reference %><br>
<%= I18n.t("mailer.submission.reference", submission_reference: @mailer_options.submission_reference) %>
</p>
<p style="margin: 0 0 20px 0; border-left: 10px solid #B1B4B6; padding: 15px;">
<%= I18n.t("mailer.submission.check_before_using") %>
Expand Down
3 changes: 3 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ en:
check_before_using: Check that this data looks safe before you use it
file_attached: "%{filename} (attached to this email)"
from: GOV.UK Forms <%{email_address}>
reference: 'GOV.​UK Forms reference number: %{submission_reference}'
subject: 'Form submission: %{form_title} - reference: %{reference}'
time: This form was submitted at %{time} on %{date}
title: This is a completed “%{title}” form.
mode:
phase_banner_tag_preview-archived: Archived preview
phase_banner_tag_preview-draft: Draft preview
Expand Down
10 changes: 9 additions & 1 deletion spec/mailers/aws_ses_form_submission_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@
expect(mail.body).to match(answer_content)
end

it "includes the form title text" do
expect(mail.body).to have_css("p", text: I18n.t("mailer.submission.title", title:))
end

it "includes text about the submission time" do
expect(mail.body).to have_css("p", text: I18n.t("mailer.submission.time", time: submission_timestamp.strftime("%l:%M%P").strip, date: submission_timestamp.strftime("%-d %B %Y")))
end

it "includes the submission reference" do
expect(mail.body).to match("reference number: #{submission_reference}")
expect(mail.body).to have_css("p", text: I18n.t("mailer.submission.reference", submission_reference:))
end

it "includes text about checking the answers" do
Expand Down

0 comments on commit 26bc389

Please sign in to comment.