Skip to content

Commit

Permalink
Use en.yml for text and render an info section
Browse files Browse the repository at this point in the history
  • Loading branch information
peteglondon committed Jan 11, 2024
1 parent 1371f19 commit 43576f9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
18 changes: 15 additions & 3 deletions app/views/metrics/_email_subscriptions.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
<h2 class="section-content__header content-metrics__header"><%= t("metrics.email_subscriptions.title") %></h2>
<% if @email_subscriptions.present? %>
<p><strong>Subscribers:</strong> <%= @email_subscriptions.subscriber_list_count %></p>
<p><strong>All notification subscribers:</strong> <%=@email_subscriptions.all_notify_count %></p>
<p><strong><%= t("metrics.email_subscriptions.active_title") %>:</strong> <%= @email_subscriptions.subscriber_list_count %></p>
<p><strong><%= t("metrics.email_subscriptions.total_notify_title") %>:</strong> <%=@email_subscriptions.all_notify_count %></p>
<% else %>
<p>No subscription information found</p>
<p><%= t("metrics.email_subscriptions.no_information") %></p>
<% end %>

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

<h3 class="govuk-heading-m"><%= t("metrics.email_subscriptions.active_title") %></h3>
<p class="govuk-body govuk-body-s"><%= t("metrics.email_subscriptions.active_description") %></p>

<h3 class="govuk-heading-m"><%= t("metrics.email_subscriptions.total_notify_title") %></h3>
<p class="govuk-body govuk-body-s"><%= t("metrics.email_subscriptions.total_notify_description") %></p>

<% end %>
6 changes: 6 additions & 0 deletions config/locales/defaults/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
18 changes: 14 additions & 4 deletions spec/features/single_content_item_email_subs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 43576f9

Please sign in to comment.