Skip to content

Commit

Permalink
Merge pull request #2518 from alphagov/remove-brexit-sidebar
Browse files Browse the repository at this point in the history
Remove Brexit call to action from contextual sidebar
  • Loading branch information
alex-ju authored Mar 4, 2022
2 parents e779984 + a197310 commit 696175d
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 206 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
useful summary for people upgrading their application, not a replication
of the commit log.

## Unreleased

* Remove Brexit call to action from contextual sidebar ([#2518](https://github.com/alphagov/govuk_publishing_components/pull/2518))

## 28.9.0

* Add 'Invasion of Ukraine' CTA to pages tagged to the topical event ([PR #2657](https://github.com/alphagov/govuk_publishing_components/pull/2657))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
$transition-campaign-red: #ff003b;

.gem-c-contextual-sidebar__related-links {
border-top: 2px solid $govuk-brand-colour;
}
Expand All @@ -26,7 +24,3 @@ $transition-campaign-red: #ff003b;
padding: 0 govuk-spacing(3) govuk-spacing(3);
text-decoration: none;
}

.gem-c-contextual-sidebar__cta--brexit {
border-top: 2px solid $transition-campaign-red;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@
<% if navigation.show_ukraine_cta? %>
<%= render 'govuk_publishing_components/components/contextual_sidebar/ukraine_cta', content_item: content_item %>
<% end %>

<% if navigation.show_brexit_cta? %>
<%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta', content_item: content_item %>
<% end %>
</div>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -86,33 +86,6 @@ examples:
- text: The Highway Code
href: "/guidance/the-highway-code"
optional: false
with_brexit_cta:
description: For documents tagged with certain taxons defined in `brexit_cta_taxon_allow_list` we show a custom Brexit call to action element.
data:
content_item:
title: "Transport news story"
content_id: "3c402d90-fe77-49b9-a8aa-1800d4fc2b3d"
locale: "en"
links:
ordered_related_items:
- title: Find an apprenticeship
base_path: /apply-apprenticeship
- title: Training and study at work
base_path: /training-study-work-your-rights
- title: Careers helpline for teenagers
base_path: /careers-helpline-for-teenagers
document_collections:
- title: Recruit an apprentice (formerly apprenticeship vacancies)
base_path: /government/collections/apprenticeship-vacancies
document_type: document_collection
- title: The future of jobs and skills
base_path: /government/collections/the-future-of-jobs-and-skills
document_type: document_collection
taxons:
- content_id: "2f8b848d-23c8-4f42-a41a-df1f81c64d0f"
title: "Exporting"
phase: "live"

with_ukraine_cta:
description: For documents tagged to the Ukraine topical event we show a custom 'Ukraine Invasion' call to action element.
data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,51 +108,6 @@ def tagged_to_brexit?
false
end

def brexit_cta_taxon_allow_list
# Overseas businesses: exporting to the UK
# Exporting goods and services
# Exporting
# Manufacturing, wholesaling, importing and exporting medicines
# Importing goods and services
# Importing
# Manufacturing, wholesaling, importing and exporting medicines
%w[
2f8b848d-23c8-4f42-a41a-df1f81c64d0f
8af13fba-d969-4d87-a02e-2e71783d47be
efa9782b-a3d0-4ca0-9c92-3b89748175b7
f441e630-2bba-4bbd-8c1b-22ae61cc00c2
4788b4b8-2642-47ca-bfc2-bd7e8705a1da
d74faafc-781d-4087-8e0c-be4216180059
f441e630-2bba-4bbd-8c1b-22ae61cc00c2
]
end

def brexit_cta_taxon_allow_list?
taxons = content_item.dig("links", "taxons").to_a
taxons.each do |taxon|
if brexit_cta_taxon_allow_list.include?(taxon["content_id"]) || parent_taxon_include?(taxon, brexit_cta_taxon_allow_list)
return true
end
end
false
end

def parent_taxon_include?(taxon, taxon_list)
if taxon.present?
if taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| taxon_list.include?(taxon_item["content_id"]) }
return true
end

taxon.dig("links", "parent_taxons").to_a.any? { |taxon_item| parent_taxon_include?(taxon_item, taxon_list) }
else
false
end
end

def show_brexit_cta?
brexit_cta_taxon_allow_list?
end

def content_tagged_to_current_step_by_step?
# TODO: remove indirection here
step_nav_helper.show_header?
Expand Down
36 changes: 0 additions & 36 deletions spec/components/brexit_cta_spec.rb

This file was deleted.

54 changes: 0 additions & 54 deletions spec/components/contextual_sidebar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,58 +21,4 @@ def component_name
end
assert_select ".gem-c-contextual-sidebar"
end

it "renders Brexit CTA on allowed taxons" do
content_item = {
"title" => "Transport news story",
"content_id" => "3c402d90-fe77-49b9-a8aa-1800d4fc2b3d",
"locale" => "en",
"links" => {
"taxons" => [
{
"content_id" => "13d01427-33b5-4ca4-bf7a-68425f54e236",
"title" => "Rail",
"phase" => "live",
"links" => {
"parent_taxons" => [
{
"content_id" => "f441e630-2bba-4bbd-8c1b-22ae61cc00c2",
"title" => "Importing",
},
],
},
},
],
},
}
render_component(content_item: content_item)
assert_select ".gem-c-contextual-sidebar__cta.gem-c-contextual-sidebar__cta--brexit"
end

it "does not render Brexit CTA when not tagged to an allowed taxon" do
content_item = {
"title" => "Local transport news story",
"content_id" => "5c82db20-7631-11e4-a3cb-005056011aef",
"locale" => "en",
"links" => {
"taxons" => [
{
"content_id" => "3b4d6319-fcef-4637-b35a-e3df76321894",
"title" => "Local transport",
"phase" => "live",
"links" => {
"parent_taxons" => [
{
"content_id" => "a4038b29-b332-4f13-98b1-1c9709e216bc",
"title" => "Transport",
},
],
},
},
],
},
}
render_component(content_item: content_item)
assert_select ".gem-c-contextual-sidebar__cta.gem-c-contextual-sidebar__cta--brexit", 0
end
end
7 changes: 0 additions & 7 deletions spec/features/contextual_navigation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
and_i_visit_that_page
then_i_see_the_step_by_step
and_the_step_by_step_header
and_i_do_not_see_the_brexit_call_to_action
end

scenario "There's more than one step by step" do
Expand Down Expand Up @@ -556,12 +555,6 @@ def then_i_see_the_brexit_individuals_contextual_breadcrumbs
and_i_see_the_brexit_contextual_breadcrumbs(brexit_individuals_taxon)
end

def and_i_do_not_see_the_brexit_call_to_action
within ".gem-c-contextual-sidebar" do
expect(page).not_to have_selector(".gem-c-contextual-sidebar__cta.gem-c-contextual-sidebar__cta--brexit")
end
end

def then_i_see_the_step_by_step_breadcrumbs
within ".gem-c-contextual-breadcrumbs" do
expect(page).to have_link("A step by step page")
Expand Down

0 comments on commit 696175d

Please sign in to comment.