From ba4e4f52d64f7ff8257cf18b5d3c877a990f79fa Mon Sep 17 00:00:00 2001 From: pezholio Date: Wed, 4 Dec 2024 14:33:03 +0000 Subject: [PATCH 1/5] Update context in workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rather than repeating ourselves, let’s use a helper method --- .../content_block/editions/workflow_controller.rb | 5 +++++ .../content_block/editions/workflow/review_links.html.erb | 2 +- .../editions/workflow/schedule_publishing.html.erb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions/workflow_controller.rb b/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions/workflow_controller.rb index 0e1aab47697..7dc37681824 100644 --- a/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions/workflow_controller.rb +++ b/lib/engines/content_block_manager/app/controllers/content_block_manager/content_block/editions/workflow_controller.rb @@ -47,6 +47,11 @@ def update end end + def context + "Edit content block" + end + helper_method :context + private def edit_draft diff --git a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb index 0692f45f7e6..8b49dc54163 100644 --- a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb @@ -1,4 +1,4 @@ -<% content_for :context, "Manage #{add_indefinite_article @content_block_document.block_type.humanize}" %> +<% content_for :context, context %> <% content_for :title, "Where the change will appear" %> <% content_for :title_margin_bottom, 4 %> <% content_for :back_link do %> diff --git a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/schedule_publishing.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/schedule_publishing.html.erb index f14239ee1d0..c497b0b9fda 100644 --- a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/schedule_publishing.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/schedule_publishing.html.erb @@ -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 %> From 3299aedd9e3b99003178dfc6039eea70afeda6f5 Mon Sep 17 00:00:00 2001 From: pezholio Date: Wed, 4 Dec 2024 14:35:11 +0000 Subject: [PATCH 2/5] Update body copy --- .../content_block/editions/workflow/review_links.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb index 8b49dc54163..ff62b3b8fd5 100644 --- a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb @@ -7,7 +7,9 @@ } %> <% end %> -

The new <%= @content_block_document.block_type.humanize.downcase %> will appear on the following content after you publish the change.

+

+ The list does not include content in PDF or beyond GOV.UK. +

<%= render( From 86abc43a0d9193e7211464959e376f49377e1eb4 Mon Sep 17 00:00:00 2001 From: pezholio Date: Wed, 4 Dec 2024 14:36:02 +0000 Subject: [PATCH 3/5] Change title for host editions table --- .../content_block/editions/workflow/review_links.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb index ff62b3b8fd5..60a23dfd781 100644 --- a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb @@ -24,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, From 6f91e66b4fb6e257fe6142595dca179a2a731457 Mon Sep 17 00:00:00 2001 From: pezholio Date: Wed, 4 Dec 2024 14:39:00 +0000 Subject: [PATCH 4/5] Alter table order Additionally, display `0` if there are no page views present for a host edition. --- .../show/host_editions_table_component.html.erb | 10 +++++----- .../document/show/host_editions_table_component.rb | 4 ++-- .../show/host_editions_table_component_test.rb | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.html.erb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.html.erb index 39f348e9655..e47004ffd86 100644 --- a/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.html.erb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.html.erb @@ -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"), diff --git a/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.rb b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.rb index 5f56dbe7dc8..1beffeaacdf 100644 --- a/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.rb +++ b/lib/engines/content_block_manager/app/components/content_block_manager/content_block/document/show/host_editions_table_component.rb @@ -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), diff --git a/lib/engines/content_block_manager/test/components/content_block/document/show/host_editions_table_component_test.rb b/lib/engines/content_block_manager/test/components/content_block/document/show/host_editions_table_component_test.rb index 27e075ce0c2..f53ba13aec6 100644 --- a/lib/engines/content_block_manager/test/components/content_block/document/show/host_editions_table_component_test.rb +++ b/lib/engines/content_block_manager/test/components/content_block/document/show/host_editions_table_component_test.rb @@ -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:, @@ -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 From 81de90ad78a332784fdb78116e74171aa0f8c8e3 Mon Sep 17 00:00:00 2001 From: pezholio Date: Wed, 4 Dec 2024 14:41:18 +0000 Subject: [PATCH 5/5] Change title of review links page This makes it clearer what the purpose of the page is --- .../content_block/editions/workflow/review_links.html.erb | 2 +- .../features/step_definitions/content_block_manager_steps.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb index 60a23dfd781..84fa45f29b2 100644 --- a/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb +++ b/lib/engines/content_block_manager/app/views/content_block_manager/content_block/editions/workflow/review_links.html.erb @@ -1,5 +1,5 @@ <% content_for :context, context %> -<% content_for :title, "Where the change will appear" %> +<% 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", { diff --git a/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb b/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb index 5498583214e..9a1d940bc93 100644 --- a/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb +++ b/lib/engines/content_block_manager/features/step_definitions/content_block_manager_steps.rb @@ -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"]