Skip to content

Commit

Permalink
Merge pull request #9700 from alphagov/content-modelling/746-update-p…
Browse files Browse the repository at this point in the history
…review-email-address-screen-in-the-edit-journey

(746) Update preview email address screen in the edit journey
  • Loading branch information
pezholio authored Dec 4, 2024
2 parents bdea537 + 81de90a commit aa313b1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ it out for now-->
href: sort_link("document_type"),
sort_direction: sort_direction("document_type"),
},
{
text: "Instances",
href: sort_link("instances"),
sort_direction: sort_direction("instances"),
},
{
text: "Views (30 days)",
href: sort_link("unique_pageviews"),
sort_direction: sort_direction("unique_pageviews"),
},
{
text: "Instances",
href: sort_link("instances"),
sort_direction: sort_direction("instances"),
},
{
text: "Lead organisation",
href: sort_link("primary_publishing_organisation_title"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ def rows
text: content_item.document_type.humanize,
},
{
text: content_item.instances,
text: content_item.unique_pageviews ? number_to_human(content_item.unique_pageviews, format: "%n%u", precision: 3, significant: true, units: { thousand: "k", million: "m", billion: "b" }) : 0,
},
{
text: content_item.unique_pageviews ? number_to_human(content_item.unique_pageviews, format: "%n%u", precision: 3, significant: true, units: { thousand: "k", million: "m", billion: "b" }) : nil,
text: content_item.instances,
},
{
text: organisation_link(content_item),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ def update
end
end

def context
"Edit content block"
end
helper_method :context

private

def edit_draft
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<% content_for :context, "Manage #{add_indefinite_article @content_block_document.block_type.humanize}" %>
<% content_for :title, "Where the change will appear" %>
<% content_for :context, context %>
<% content_for :title, "Preview #{@content_block_document.block_type.humanize.downcase}" %>
<% content_for :title_margin_bottom, 4 %>
<% content_for :back_link do %>
<%= render "govuk_publishing_components/components/back_link", {
href: content_block_manager.new_content_block_manager_content_block_document_edition_path(@content_block_document),
} %>
<% end %>

<p class="govuk-body">The new <%= @content_block_document.block_type.humanize.downcase %> will appear on the following content after you publish the change.</p>
<p class="govuk-body">
The list does not include content in PDF or beyond <a href="https://gov.uk" class="govuk-link">GOV.UK</a>.
</p>

<%=
render(
Expand All @@ -22,7 +24,7 @@
<%= render(
ContentBlockManager::ContentBlock::Document::Show::HostEditionsTableComponent.new(
is_preview: true,
caption: "Content it appears in",
caption: "List of locations",
host_content_items: @host_content_items,
current_page: @page,
order: @order,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% content_for :context, "Manage #{add_indefinite_article @content_block_edition.document.block_type.humanize}" %>
<% content_for :context, context %>
<% content_for :title, "When do you want to publish the change?" %>
<% content_for :title_margin_bottom, 4 %>
<% content_for :back_link do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def should_show_edit_form_for_email_address_content_block(document_title, email_
end

Then(/^I am shown where the changes will take place$/) do
expect(page).to have_selector("h1", text: "Where the change will appear")
expect(page).to have_selector("h1", text: "Preview email address")

@dependent_content.each do |item|
assert_text item["title"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def self.it_returns_unknown_user
context "when unique pageviews can't be found" do
let(:unique_pageviews) { nil }

it "displays not found" do
it "displays a zero" do
render_inline(
described_class.new(
caption:,
Expand All @@ -179,7 +179,7 @@ def self.it_returns_unknown_user
),
)

assert_selector "tbody .govuk-table__cell", text: "Not set"
assert_selector "tbody .govuk-table__cell", text: "0"
end
end

Expand Down

0 comments on commit aa313b1

Please sign in to comment.