From 33a5810856a03d67906d8a43098d6cf9e7cbf5d6 Mon Sep 17 00:00:00 2001 From: Dana Cotoran Date: Tue, 8 Mar 2022 15:52:50 +0000 Subject: [PATCH 1/2] Update email subscription banner content Update the single page notification success banner content based on input from our designers and reduce some repetition in the email_subscribe_unsubscribe_flash partial --- app/controllers/content_items_controller.rb | 6 +++ ...email_subscribe_unsubscribe_flash.html.erb | 42 +++++++++---------- config/locales/ar.yml | 2 +- config/locales/az.yml | 2 +- config/locales/be.yml | 2 +- config/locales/bg.yml | 2 +- config/locales/bn.yml | 2 +- config/locales/cs.yml | 2 +- config/locales/cy.yml | 2 +- config/locales/da.yml | 2 +- config/locales/de.yml | 2 +- config/locales/dr.yml | 2 +- config/locales/el.yml | 2 +- config/locales/en.yml | 2 +- config/locales/es-419.yml | 2 +- config/locales/es.yml | 2 +- config/locales/et.yml | 2 +- config/locales/fa.yml | 2 +- config/locales/fi.yml | 2 +- config/locales/fr.yml | 2 +- config/locales/gd.yml | 2 +- config/locales/gu.yml | 2 +- config/locales/he.yml | 2 +- config/locales/hi.yml | 2 +- config/locales/hr.yml | 2 +- config/locales/hu.yml | 2 +- config/locales/hy.yml | 2 +- config/locales/id.yml | 2 +- config/locales/is.yml | 2 +- config/locales/it.yml | 2 +- config/locales/ja.yml | 2 +- config/locales/ka.yml | 2 +- config/locales/kk.yml | 2 +- config/locales/ko.yml | 2 +- config/locales/lt.yml | 2 +- config/locales/lv.yml | 2 +- config/locales/ms.yml | 2 +- config/locales/mt.yml | 2 +- config/locales/ne.yml | 2 +- config/locales/nl.yml | 2 +- config/locales/no.yml | 2 +- config/locales/pa-pk.yml | 2 +- config/locales/pa.yml | 2 +- config/locales/pl.yml | 2 +- config/locales/ps.yml | 2 +- config/locales/pt.yml | 2 +- config/locales/ro.yml | 2 +- config/locales/ru.yml | 2 +- config/locales/si.yml | 2 +- config/locales/sk.yml | 2 +- config/locales/sl.yml | 2 +- config/locales/so.yml | 2 +- config/locales/sq.yml | 2 +- config/locales/sr.yml | 2 +- config/locales/sv.yml | 2 +- config/locales/sw.yml | 2 +- config/locales/ta.yml | 2 +- config/locales/th.yml | 2 +- config/locales/tk.yml | 2 +- config/locales/tr.yml | 2 +- config/locales/uk.yml | 2 +- config/locales/ur.yml | 2 +- config/locales/uz.yml | 2 +- config/locales/vi.yml | 2 +- config/locales/yi.yml | 2 +- config/locales/zh-hk.yml | 2 +- config/locales/zh-tw.yml | 2 +- config/locales/zh.yml | 2 +- 68 files changed, 91 insertions(+), 89 deletions(-) diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index 342e9055a..5ed2e62c3 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -13,6 +13,8 @@ class ContentItemsController < ApplicationController attr_accessor :content_item, :taxonomy_navigation + helper_method :show_email_subscription_success_banner? + def show load_content_item @@ -46,6 +48,10 @@ def service_sign_in_options end end + def show_email_subscription_success_banner? + @account_flash.include?("email-subscription-success") || @account_flash.include?("email-unsubscribe-success") || @account_flash.include?("email-subscription-already-subscribed") + end + private def is_history_page? diff --git a/app/views/shared/_email_subscribe_unsubscribe_flash.html.erb b/app/views/shared/_email_subscribe_unsubscribe_flash.html.erb index 7b30e919d..ef3f21337 100644 --- a/app/views/shared/_email_subscribe_unsubscribe_flash.html.erb +++ b/app/views/shared/_email_subscribe_unsubscribe_flash.html.erb @@ -1,29 +1,25 @@ -<% if @account_flash.include?("email-subscription-success") %> +<% banner_heading = capture do %> + <% + if @account_flash.include?("email-subscription-success") + sanitize(t("email.subscribe_title")) + elsif @account_flash.include?("email-unsubscribe-success") + sanitize(t("email.unsubscribe_title")) + elsif @account_flash.include?("email-subscription-already-subscribed") + sanitize(t("email.already_subscribed_title")) + end + %> +<% end %> + +<% banner_description = capture do %> + <%= t("email.description") %> +<% end %> + +<% if show_email_subscription_success_banner? %>
<%= render "govuk_publishing_components/components/success_alert", { - message: sanitize(t("email.subscribe_title")), - description: sanitize(t("email.description_html")), - margin_bottom: 0, - } %> -
-
-<% elsif @account_flash.include?("email-unsubscribe-success") %> -
-
- <%= render "govuk_publishing_components/components/success_alert", { - message: sanitize(t("email.unsubscribe_title")), - description: sanitize(t("email.description_html")), - margin_bottom: 0, - } %> -
-
-<% elsif @account_flash.include?("email-subscription-already-subscribed") %> -
-
- <%= render "govuk_publishing_components/components/success_alert", { - message: sanitize(t("email.already_subscribed_title")), - description: sanitize(t("email.description_html")), + message: banner_heading, + description: banner_description, margin_bottom: 0, } %>
diff --git a/config/locales/ar.yml b/config/locales/ar.yml index e934b844b..b902bd345 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -599,7 +599,7 @@ ar: welsh_language_scheme_html: تعرف على التزامنا بشأن %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/az.yml b/config/locales/az.yml index 34b8b172f..e3aeda9d0 100644 --- a/config/locales/az.yml +++ b/config/locales/az.yml @@ -299,7 +299,7 @@ az: welsh_language_scheme_html: "%{link} ilə bağlı öhdəliyimiz barədə öyrənin." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/be.yml b/config/locales/be.yml index b1c244b16..8e8e09fea 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -449,7 +449,7 @@ be: welsh_language_scheme_html: Даведайцеся аб нашых абавязках да публікацыі ў %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/bg.yml b/config/locales/bg.yml index a360038d4..91fe226ae 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -299,7 +299,7 @@ bg: welsh_language_scheme_html: Научете повече за нашия ангажимент към %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/bn.yml b/config/locales/bn.yml index d3c169be9..2cae5abef 100644 --- a/config/locales/bn.yml +++ b/config/locales/bn.yml @@ -299,7 +299,7 @@ bn: welsh_language_scheme_html: "%{link}-এ আপনার আমাদের অঙ্গীকার সম্পর্কে জানুন।" email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 529bfa494..4d9fa9209 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -374,7 +374,7 @@ cs: welsh_language_scheme_html: Přečtěte si o našem závazku k %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/cy.yml b/config/locales/cy.yml index 84f8069ef..f46641135 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -599,7 +599,7 @@ cy: welsh_language_scheme_html: Dysgwch am ein hymrwymiad i %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/da.yml b/config/locales/da.yml index 6a857afe4..222117a2c 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -311,7 +311,7 @@ da: welsh_language_scheme_html: Learn more about our commitment to% {link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/de.yml b/config/locales/de.yml index df75f2162..512b1c0e2 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -299,7 +299,7 @@ de: welsh_language_scheme_html: Informieren Sie sich über unser Engagement für %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/dr.yml b/config/locales/dr.yml index e81776b5c..54f94694d 100644 --- a/config/locales/dr.yml +++ b/config/locales/dr.yml @@ -299,7 +299,7 @@ dr: welsh_language_scheme_html: از تعهد ما به %{link} مطلع شوید. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/el.yml b/config/locales/el.yml index b49064aeb..556a915ff 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -299,7 +299,7 @@ el: welsh_language_scheme_html: Μάθετε για τη δέσμευσή μας στο %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/en.yml b/config/locales/en.yml index 39f01f734..b1c5e48c8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -299,7 +299,7 @@ en: welsh_language_scheme_html: Find out about our commitment to %{link}. email: already_subscribed_title: You’re already getting emails about this page - description_html:

Go to your GOV.UK account to see and manage all your GOV.UK email subscriptions.

+ description: See and manage all your GOV.UK email subscriptions subscribe_title: You’ve subscribed to emails about this page unsubscribe_title: You’ve unsubscribed from emails about this page fatality_notice: diff --git a/config/locales/es-419.yml b/config/locales/es-419.yml index e415e70b5..b21e37492 100644 --- a/config/locales/es-419.yml +++ b/config/locales/es-419.yml @@ -299,7 +299,7 @@ es-419: welsh_language_scheme_html: Conozca nuestro compromiso con %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/es.yml b/config/locales/es.yml index 98c7910a3..448296b60 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -299,7 +299,7 @@ es: welsh_language_scheme_html: Encuentre más sobre nuestro compromiso de publicar en %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/et.yml b/config/locales/et.yml index 8ca799dc7..9303a9de8 100644 --- a/config/locales/et.yml +++ b/config/locales/et.yml @@ -299,7 +299,7 @@ et: welsh_language_scheme_html: Lisateave meie pühendumuse kohta %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/fa.yml b/config/locales/fa.yml index d6efb40e5..2838a3455 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -299,7 +299,7 @@ fa: welsh_language_scheme_html: درباره تعهد ما نسبت به %{link} اطلاعات کسب کنید. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 568c68850..1f35a5711 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -299,7 +299,7 @@ fi: welsh_language_scheme_html: Tutustu sitoumukseemme %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ddcb85963..c91ae92e4 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -299,7 +299,7 @@ fr: welsh_language_scheme_html: Découvrez comment nous nous engageons sur %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/gd.yml b/config/locales/gd.yml index 080dc8cd3..43e7b3305 100644 --- a/config/locales/gd.yml +++ b/config/locales/gd.yml @@ -449,7 +449,7 @@ gd: welsh_language_scheme_html: Faigh amach ár gcomhréiteach ar an %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/gu.yml b/config/locales/gu.yml index 832fc33d8..466629f2e 100644 --- a/config/locales/gu.yml +++ b/config/locales/gu.yml @@ -299,7 +299,7 @@ gu: welsh_language_scheme_html: "%{link} પ્રત્યે અમારી પ્રતિબદ્ધતા અંગે જાણો." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/he.yml b/config/locales/he.yml index b90f9738f..468c317a2 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -299,7 +299,7 @@ he: welsh_language_scheme_html: מידע נוסף על המחויבות שלנו לפרסום %{link} email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/hi.yml b/config/locales/hi.yml index cc1fc408b..c2296a766 100644 --- a/config/locales/hi.yml +++ b/config/locales/hi.yml @@ -299,7 +299,7 @@ hi: welsh_language_scheme_html: हमारी प्रकाशन के प्रति वचनबद्धता के बारे में जानें %(link)। email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 56147d917..07b5486fe 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -449,7 +449,7 @@ hr: welsh_language_scheme_html: Saznajte o našoj predanosti %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/hu.yml b/config/locales/hu.yml index d51399d5c..e5a54666e 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -299,7 +299,7 @@ hu: welsh_language_scheme_html: 'Tájékozódjon az információk közzétételével kapcsolatos elkötelezettségünkről: %{link}' email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/hy.yml b/config/locales/hy.yml index 25b87b6d8..b8ec03c77 100644 --- a/config/locales/hy.yml +++ b/config/locales/hy.yml @@ -299,7 +299,7 @@ hy: welsh_language_scheme_html: 'Տեղեկանալ մեր աշխատանքի մասին %{link} հղումով:' email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/id.yml b/config/locales/id.yml index f99684049..4186baa9f 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -224,7 +224,7 @@ id: welsh_language_scheme_html: Cari tahu komitmen kami kepada %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/is.yml b/config/locales/is.yml index 0dc507344..00ff034d6 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -299,7 +299,7 @@ is: welsh_language_scheme_html: Kynntu þér skuldbindingu okkar við %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/it.yml b/config/locales/it.yml index b2bda6ade..5c5735d2e 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -299,7 +299,7 @@ it: welsh_language_scheme_html: Scopri il nostro impegno per %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ja.yml b/config/locales/ja.yml index e39c8f5cc..d6f1faad4 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -224,7 +224,7 @@ ja: welsh_language_scheme_html: 情報公開の詳細については %{link} をご覧下さい。 email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ka.yml b/config/locales/ka.yml index 7518804c8..36a843132 100644 --- a/config/locales/ka.yml +++ b/config/locales/ka.yml @@ -299,7 +299,7 @@ ka: welsh_language_scheme_html: გაეცანით ჩვენს ვალდებულებას %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/kk.yml b/config/locales/kk.yml index 50909dcb5..6120af014 100644 --- a/config/locales/kk.yml +++ b/config/locales/kk.yml @@ -299,7 +299,7 @@ kk: welsh_language_scheme_html: "%{link} қосқан үлесіміз туралы оқыңыз." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 16c063d49..5d6d4a6fe 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -224,7 +224,7 @@ ko: welsh_language_scheme_html: "%{link} 에서 정보 공개에 대한 내용." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 90464f079..e12f2e583 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -374,7 +374,7 @@ lt: welsh_language_scheme_html: Sužinokite apie mūsų įsipareigojimą skelbti %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/lv.yml b/config/locales/lv.yml index dd8cc6e05..e01893a53 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -299,7 +299,7 @@ lv: welsh_language_scheme_html: Vairāk par mūsu apņemšanos nodrošināt informācijas pieejamību %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ms.yml b/config/locales/ms.yml index fffff80a3..3896d3038 100644 --- a/config/locales/ms.yml +++ b/config/locales/ms.yml @@ -224,7 +224,7 @@ ms: welsh_language_scheme_html: Ketahui tentang komitmen kami kepada %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/mt.yml b/config/locales/mt.yml index eac016b86..7823b0f1c 100644 --- a/config/locales/mt.yml +++ b/config/locales/mt.yml @@ -449,7 +449,7 @@ mt: welsh_language_scheme_html: Kun af dwar l-impenn tagħna lejn %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ne.yml b/config/locales/ne.yml index cbb09ab08..b72a6b828 100644 --- a/config/locales/ne.yml +++ b/config/locales/ne.yml @@ -299,7 +299,7 @@ ne: welsh_language_scheme_html: "%{link} को हाम्रो प्रतिबद्धताको बारेमा जानकारी पाउनुहोस्।" email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 5f965c831..e6eaaa50f 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -299,7 +299,7 @@ nl: welsh_language_scheme_html: Lees meer over onze inzet voor %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/no.yml b/config/locales/no.yml index 66a7dd77d..cb52f8449 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -299,7 +299,7 @@ welsh_language_scheme_html: Finn ut mer om vårt engasjement for %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/pa-pk.yml b/config/locales/pa-pk.yml index 568f477c9..7bd8f75c7 100644 --- a/config/locales/pa-pk.yml +++ b/config/locales/pa-pk.yml @@ -299,7 +299,7 @@ pa-pk: welsh_language_scheme_html: ساڈی وابستگی دے بارے جانو {link}%. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/pa.yml b/config/locales/pa.yml index 14ebeea1c..7686dffaf 100644 --- a/config/locales/pa.yml +++ b/config/locales/pa.yml @@ -299,7 +299,7 @@ pa: welsh_language_scheme_html: "%{link} ਪ੍ਰਤੀ ਸਾਡੀ ਵਚਨਬੱਧਤਾ ਬਾਰੇ ਜਾਣੋ।" email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 830d7de5d..2fa790161 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -449,7 +449,7 @@ pl: welsh_language_scheme_html: Poznaj nasze zobowiązania związane z publikowaniem w %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ps.yml b/config/locales/ps.yml index bc06d2d6d..204551034 100644 --- a/config/locales/ps.yml +++ b/config/locales/ps.yml @@ -299,7 +299,7 @@ ps: welsh_language_scheme_html: "%{link} ته زموږ د ژمنتیا په اړه معلومات ترلاسه کړئ." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 3aecf46ca..95b558219 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -299,7 +299,7 @@ pt: welsh_language_scheme_html: Saiba mais sobre o nosso compromisso para com %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 00d30de2b..71a778c27 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -374,7 +374,7 @@ ro: welsh_language_scheme_html: Aflați mai multe despre angajamentul nostru pentru %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index e78a635d1..195e739b0 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -449,7 +449,7 @@ ru: welsh_language_scheme_html: Узнайте о наших обязательствах по %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/si.yml b/config/locales/si.yml index fcd464215..ce0734104 100644 --- a/config/locales/si.yml +++ b/config/locales/si.yml @@ -299,7 +299,7 @@ si: welsh_language_scheme_html: "%{link} සඳහා අපේ කැපවීම ගැන සොයා බලන්න." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 00f950545..4ea9b3490 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -374,7 +374,7 @@ sk: welsh_language_scheme_html: Prečítajte si o našom záväzku voči %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 21a348cd8..1e5919df6 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -449,7 +449,7 @@ sl: welsh_language_scheme_html: Izvedite več o naši zavezanosti %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/so.yml b/config/locales/so.yml index 31df6dbf6..346f41401 100644 --- a/config/locales/so.yml +++ b/config/locales/so.yml @@ -299,7 +299,7 @@ so: welsh_language_scheme_html: Raadi waxyaabaha ku saabsan ka go'naanshahayaga %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/sq.yml b/config/locales/sq.yml index 61340c60e..afc88a191 100644 --- a/config/locales/sq.yml +++ b/config/locales/sq.yml @@ -299,7 +299,7 @@ sq: welsh_language_scheme_html: Mësoni rreth angazhimit tonë ndaj %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 248152114..c8a1dc443 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -449,7 +449,7 @@ sr: welsh_language_scheme_html: Saznajte više o našoj posvećenosti %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 445ec1282..fe7952ef4 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -299,7 +299,7 @@ sv: welsh_language_scheme_html: Ta reda på vårt åtagande om %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/sw.yml b/config/locales/sw.yml index 3d9be721e..fa8d8dd84 100644 --- a/config/locales/sw.yml +++ b/config/locales/sw.yml @@ -299,7 +299,7 @@ sw: welsh_language_scheme_html: Pata maelezo kuhusu wajibu wetu wa %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ta.yml b/config/locales/ta.yml index b597e8165..cef1ca60c 100644 --- a/config/locales/ta.yml +++ b/config/locales/ta.yml @@ -299,7 +299,7 @@ ta: welsh_language_scheme_html: "%{link}-க்கு எங்கள் கடப்பாடு குறித்துக் கண்டறியுங்கள்." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/th.yml b/config/locales/th.yml index 91d20365a..aa0f6b025 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -224,7 +224,7 @@ th: welsh_language_scheme_html: ดูข้อมูลเพิ่มเติมเกี่ยวกับพันธกิจของเราสำหรับ %{link} email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/tk.yml b/config/locales/tk.yml index 4434814a4..93e4cf6b7 100644 --- a/config/locales/tk.yml +++ b/config/locales/tk.yml @@ -299,7 +299,7 @@ tk: welsh_language_scheme_html: Niýetimiz barada %{link}-da okaň. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/tr.yml b/config/locales/tr.yml index bcef4e3ad..656073b7f 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -299,7 +299,7 @@ tr: welsh_language_scheme_html: "%{link} bağlantısına taahhüdümüzü okuyun." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 0c8b9bd30..c72891619 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -449,7 +449,7 @@ uk: welsh_language_scheme_html: Дізнайтесь про дотримання нами %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/ur.yml b/config/locales/ur.yml index 7a956191c..9960e16b3 100644 --- a/config/locales/ur.yml +++ b/config/locales/ur.yml @@ -299,7 +299,7 @@ ur: welsh_language_scheme_html: "%{link} کے ساتھ ہماری وابستگی کے بارے میں جانیں۔" email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/uz.yml b/config/locales/uz.yml index 7f1716232..704308e21 100644 --- a/config/locales/uz.yml +++ b/config/locales/uz.yml @@ -299,7 +299,7 @@ uz: welsh_language_scheme_html: "%{link} да бизнинг содиқлилигимиз ҳақида билиб олинг ." email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/vi.yml b/config/locales/vi.yml index d3e403e80..a2dbe4412 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -224,7 +224,7 @@ vi: welsh_language_scheme_html: Tìm hiểu về cam kết của chúng tôi đối với %{link}. email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/yi.yml b/config/locales/yi.yml index cecc9a2c9..571252202 100644 --- a/config/locales/yi.yml +++ b/config/locales/yi.yml @@ -299,7 +299,7 @@ yi: welsh_language_scheme_html: email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/zh-hk.yml b/config/locales/zh-hk.yml index b61be9cea..298c10862 100644 --- a/config/locales/zh-hk.yml +++ b/config/locales/zh-hk.yml @@ -299,7 +299,7 @@ zh-hk: welsh_language_scheme_html: 查閱我們在 %{link} 的發佈承諾。 email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/zh-tw.yml b/config/locales/zh-tw.yml index 9ea4584e1..8dc35ae60 100644 --- a/config/locales/zh-tw.yml +++ b/config/locales/zh-tw.yml @@ -299,7 +299,7 @@ zh-tw: welsh_language_scheme_html: 了解我們對 %{link} 的承諾。 email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d8b863a3d..68051b762 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -224,7 +224,7 @@ zh: welsh_language_scheme_html: 查看我们对 %{link} 的承诺。 email: already_subscribed_title: - description_html: + description: subscribe_title: unsubscribe_title: fatality_notice: From 2bbe914497ac3097b438328dc85e237dab464861 Mon Sep 17 00:00:00 2001 From: Dana Cotoran Date: Wed, 9 Mar 2022 18:00:46 +0000 Subject: [PATCH 2/2] Change based on PR suggestion --- app/controllers/content_items_controller.rb | 6 ------ app/helpers/content_items_helper.rb | 15 +++++++++++++++ .../_email_subscribe_unsubscribe_flash.html.erb | 16 ++-------------- 3 files changed, 17 insertions(+), 20 deletions(-) create mode 100644 app/helpers/content_items_helper.rb diff --git a/app/controllers/content_items_controller.rb b/app/controllers/content_items_controller.rb index 5ed2e62c3..342e9055a 100644 --- a/app/controllers/content_items_controller.rb +++ b/app/controllers/content_items_controller.rb @@ -13,8 +13,6 @@ class ContentItemsController < ApplicationController attr_accessor :content_item, :taxonomy_navigation - helper_method :show_email_subscription_success_banner? - def show load_content_item @@ -48,10 +46,6 @@ def service_sign_in_options end end - def show_email_subscription_success_banner? - @account_flash.include?("email-subscription-success") || @account_flash.include?("email-unsubscribe-success") || @account_flash.include?("email-subscription-already-subscribed") - end - private def is_history_page? diff --git a/app/helpers/content_items_helper.rb b/app/helpers/content_items_helper.rb new file mode 100644 index 000000000..8a3d4c2c8 --- /dev/null +++ b/app/helpers/content_items_helper.rb @@ -0,0 +1,15 @@ +module ContentItemsHelper + def email_subscription_success_banner_heading(account_flash) + if account_flash.include?("email-subscription-success") + sanitize(t("email.subscribe_title")) + elsif account_flash.include?("email-unsubscribe-success") + sanitize(t("email.unsubscribe_title")) + elsif account_flash.include?("email-subscription-already-subscribed") + sanitize(t("email.already_subscribed_title")) + end + end + + def show_email_subscription_success_banner?(account_flash) + account_flash.include?("email-subscription-success") || account_flash.include?("email-unsubscribe-success") || account_flash.include?("email-subscription-already-subscribed") + end +end diff --git a/app/views/shared/_email_subscribe_unsubscribe_flash.html.erb b/app/views/shared/_email_subscribe_unsubscribe_flash.html.erb index ef3f21337..3624ccff1 100644 --- a/app/views/shared/_email_subscribe_unsubscribe_flash.html.erb +++ b/app/views/shared/_email_subscribe_unsubscribe_flash.html.erb @@ -1,24 +1,12 @@ -<% banner_heading = capture do %> - <% - if @account_flash.include?("email-subscription-success") - sanitize(t("email.subscribe_title")) - elsif @account_flash.include?("email-unsubscribe-success") - sanitize(t("email.unsubscribe_title")) - elsif @account_flash.include?("email-subscription-already-subscribed") - sanitize(t("email.already_subscribed_title")) - end - %> -<% end %> - <% banner_description = capture do %> <%= t("email.description") %> <% end %> -<% if show_email_subscription_success_banner? %> +<% if show_email_subscription_success_banner?(@account_flash) %>
<%= render "govuk_publishing_components/components/success_alert", { - message: banner_heading, + message: email_subscription_success_banner_heading(@account_flash), description: banner_description, margin_bottom: 0, } %>