Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(746) Update preview email address screen in the edit journey #9700

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good idea!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wonder whether we should be a bit better at having microcopy like this in translation files. It's always one of those things that you start off thinking it's not worth doing, then as a project gets bigger you wish you'd have done sooner!

"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
Loading