From 43576f9c10913b50df3ab2bc8cfb97432865149c Mon Sep 17 00:00:00 2001 From: Pete Goddard Date: Thu, 11 Jan 2024 15:11:28 +0000 Subject: [PATCH] Use en.yml for text and render an info section --- .../metrics/_email_subscriptions.html.erb | 18 +++++++++++++++--- config/locales/defaults/en.yml | 6 ++++++ .../single_content_item_email_subs_spec.rb | 18 ++++++++++++++---- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/app/views/metrics/_email_subscriptions.html.erb b/app/views/metrics/_email_subscriptions.html.erb index 47e6fe29..ecffe450 100644 --- a/app/views/metrics/_email_subscriptions.html.erb +++ b/app/views/metrics/_email_subscriptions.html.erb @@ -1,7 +1,19 @@

<%= t("metrics.email_subscriptions.title") %>

<% if @email_subscriptions.present? %> -

Subscribers: <%= @email_subscriptions.subscriber_list_count %>

-

All notification subscribers: <%=@email_subscriptions.all_notify_count %>

+

<%= t("metrics.email_subscriptions.active_title") %>: <%= @email_subscriptions.subscriber_list_count %>

+

<%= t("metrics.email_subscriptions.total_notify_title") %>: <%=@email_subscriptions.all_notify_count %>

<% else %> -

No subscription information found

+

<%= t("metrics.email_subscriptions.no_information") %>

+<% end %> + +<%= render "govuk_publishing_components/components/details", { + title: t("metrics.email_subscriptions.about_title") +} do %> + +

<%= t("metrics.email_subscriptions.active_title") %>

+

<%= t("metrics.email_subscriptions.active_description") %>

+ +

<%= t("metrics.email_subscriptions.total_notify_title") %>

+

<%= t("metrics.email_subscriptions.total_notify_description") %>

+ <% end %> diff --git a/config/locales/defaults/en.yml b/config/locales/defaults/en.yml index ca3408e7..63e7ed92 100644 --- a/config/locales/defaults/en.yml +++ b/config/locales/defaults/en.yml @@ -11,6 +11,12 @@ en: metrics: email_subscriptions: title: 'Email subscriptions' + about_title: 'About Email subscriptions' + active_title: 'Active subscribers' + active_description: 'Active subscribers is the number of people who have clicked the Get Emails button on this page and signed up to be subscribed to valid email alerts either to this page or to pages related to this one. Note that some pages can be subscribed to, but do not generate email alerts themselves (in these cases the subscriber list will be notified if pages related to this one are updated)' + total_notify_title: 'Number of subscribers notified by change' + total_notify_description: 'Number of subscribers notified by change is the number of people who will receive emails if this page receives a major update. Note that this may be zero even if the page has active subscribers (if the page does not generate email alerts), or may be positive even if the page has no active subscribers (as there are lists that subscribe to all emails, or all emails on a certain topic)' + no_information: 'No subscription information found' upviews: title: 'Unique page views' short_title: 'Unique page views' diff --git a/spec/features/single_content_item_email_subs_spec.rb b/spec/features/single_content_item_email_subs_spec.rb index d6be6359..8d5b9605 100644 --- a/spec/features/single_content_item_email_subs_spec.rb +++ b/spec/features/single_content_item_email_subs_spec.rb @@ -31,10 +31,20 @@ it "shows the Email subscriptions section" do visit "/metrics/base/path" expect(page).to have_content("Email subscriptions") - expect(page).to have_content("Subscribers: 3") - expect(page).to have_content("All notification subscribers: 10") + expect(page).to have_content("Active subscribers: 3") + expect(page).to have_content("Number of subscribers notified by change: 10") expect(page).not_to have_content("No subscription information found") end + + it "shows information on the email metrics" do + visit "/metrics/base/path" + [ + "Active subscribers is the number of people", + "Number of subscribers notified by change is the number of people", + ].each do |txt| + expect(page).to have_content(txt) + end + end end context "when there is a 404 from email-alert-api" do @@ -46,8 +56,8 @@ visit "/metrics/base/path" expect(page).to have_content("Email subscriptions") expect(page).to have_content("No subscription information found") - expect(page).not_to have_content("Subscribers:") - expect(page).not_to have_content("All notification subscribers:") + expect(page).not_to have_content("Active subscribers:") + expect(page).not_to have_content("Number of subscribers notified by change:") end end end