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

Remove support for specialist topics #3895

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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 @@ -21,8 +21,6 @@
return document.querySelectorAll('[data-track-count="cardList"]').length
case isMainstreamBrowsePage():
return countVisible(document.querySelectorAll('#subsection ul')) || document.querySelectorAll('#section ul').length || document.querySelectorAll('#root ul').length
case isTopicPage():
return document.querySelectorAll('.topics-page nav.index-list').length
case isPolicyAreaPage():
return document.querySelectorAll('.topic section h1.label').length
case isFinderPage():
Expand Down Expand Up @@ -56,9 +54,6 @@
return document.querySelectorAll('[data-track-count="cardLink"]').length
case isMainstreamBrowsePage():
return countVisible(document.querySelectorAll('#subsection ul a')) || document.querySelectorAll('#section ul a').length || document.querySelectorAll('#root ul a').length
case isTopicPage():
return document.querySelectorAll('.topics-page .index-list ul a').length ||
document.querySelectorAll('.topics-page .topics ul a').length
case isPolicyAreaPage():
return document.querySelectorAll('section.document-block a').length +
document.querySelectorAll('section .collection-list h2 a').length
Expand Down Expand Up @@ -120,11 +115,6 @@
getMetaAttribute(metaFormatSelector) === 'mainstream_browse_page'
}

function isTopicPage () {
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
getMetaAttribute(metaFormatSelector) === 'topic'
}

function isPolicyAreaPage () {
return getMetaAttribute(metaApplicationSelector) === 'whitehall' &&
getMetaAttribute(metaFormatSelector) === 'placeholder_policy_area'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ examples:
base_path: /training-study-work-your-rights
- title: Careers helpline for teenagers
base_path: /careers-helpline-for-teenagers
with_curated_topics:
data:
content_item:
links:
topics:
- title: Apprenticeships, 14 to 19 education and training for work
base_path: /browse/education/find-course
document_type: topic
- title: Finding a job
base_path: /browse/working/finding-job
document_type: topic
- title: Apprenticeships
base_path: /topic/further-education-skills/apprenticeships
document_type: topic
with_mainstream_browse_pages:
data:
content_item:
Expand All @@ -53,43 +39,6 @@ examples:
base_path: /transport/driving-instruction-and-driving-lessons
phase: live
document_type: taxon
with_curated_topics_and_mainstream_browse_pages:
description: Currated topics and mainstream browse pages are combined.
data:
content_item:
links:
mainstream_browse_pages:
- title: Driving licences
base_path: /browse/driving/driving-licences
document_type: mainstream_browse_page
- title: Driving tests and learning to drive or ride
base_path: /browse/driving/learning-to-drive
document_type: mainstream_browse_page
topics:
- title: Cars
base_path: /topic/driving-tests-and-learning-to-drive/car
document_type: topic
with_curated_topics_and_mainstream_browse_pages_and_taxons:
description: Currated topics and mainstream browse pages take precedence over the sidewide topic taxonomy.
data:
content_item:
links:
mainstream_browse_pages:
- title: Driving licences
base_path: /browse/driving/driving-licences
document_type: mainstream_browse_page
- title: Driving tests and learning to drive or ride
base_path: /browse/driving/learning-to-drive
document_type: mainstream_browse_page
taxons:
- title: Driving instruction and driving lessons
base_path: /transport/driving-instruction-and-driving-lessons
phase: live
document_type: taxon
topics:
- title: Cars
base_path: /topic/driving-tests-and-learning-to-drive/car
document_type: topic
with_collections:
data:
content_item:
Expand Down Expand Up @@ -218,11 +167,6 @@ examples:
- title: Find an apprenticeship (French)
base_path: /apply-apprenticeship.fr
locale: fr
topics:
- title: Apprenticeships, 14 to 19 education and training for work (Korean)
base_path: /browse/education/find-course.ko
document_type: topic
locale: ko
topical_events:
- title: UK-China High-Level People to People Dialogue 2017 (Spanish)
base_path: /government/topical-events/uk-china-high-level-people-to-people-dialogue-2017.es
Expand Down Expand Up @@ -263,16 +207,6 @@ examples:
base_path: /training-study-work-your-rights
- title: Careers helpline for teenagers
base_path: /careers-helpline-for-teenagers
topics:
- title: Apprenticeships, 14 to 19 education and training for work
base_path: /browse/education/find-course
document_type: topic
- title: Finding a job
base_path: /browse/working/finding-job
document_type: topic
- title: Apprenticeships
base_path: /topic/further-education-skills/apprenticeships
document_type: topic
topical_events:
- title: UK-China High-Level People to People Dialogue 2017
base_path: /government/topical-events/uk-china-high-level-people-to-people-dialogue-2017
Expand Down Expand Up @@ -319,16 +253,6 @@ examples:
base_path: /training-study-work-your-rights
- title: Careers helpline for teenagers
base_path: /careers-helpline-for-teenagers
topics:
- title: Apprenticeships, 14 to 19 education and training for work
base_path: /browse/education/find-course
document_type: topic
- title: Finding a job
base_path: /browse/working/finding-job
document_type: topic
- title: Apprenticeships
base_path: /topic/further-education-skills/apprenticeships
document_type: topic
topical_events:
- title: UK-China High-Level People to People Dialogue 2017
base_path: /government/topical-events/uk-china-high-level-people-to-people-dialogue-2017
Expand Down
1 change: 0 additions & 1 deletion lib/govuk_publishing_components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
require "govuk_publishing_components/presenters/public_layout_helper"
require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_ancestors"
require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_taxons"
require "govuk_publishing_components/presenters/content_breadcrumbs_based_on_topic"
require "govuk_publishing_components/presenters/checkboxes_helper"
require "govuk_publishing_components/presenters/select_helper"
require "govuk_publishing_components/presenters/meta_tags"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ def options(navigation)
step_by_step: false,
breadcrumbs: navigation.breadcrumbs,
}
elsif navigation.content_has_a_topic?
{
step_by_step: false,
breadcrumbs: navigation.topic_breadcrumbs,
}
elsif navigation.use_taxon_breadcrumbs?
{
step_by_step: false,
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions lib/govuk_publishing_components/presenters/content_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ def related_statistical_data_sets
filter_link_type(content_store_response.dig("links", "related_statistical_data_sets").to_a, "statistical_data_set")
end

def related_topics
filter_link_type(content_store_response.dig("links", "topics").to_a, "topic")
end

def related_topical_events
filter_link_type(content_store_response.dig("links", "topical_events").to_a, "topical_event")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ def taxon_breadcrumbs
@taxon_breadcrumbs ||= ContentBreadcrumbsBasedOnTaxons.call(content_item)
end

def topic_breadcrumbs
@topic_breadcrumbs ||= ContentBreadcrumbsBasedOnTopic.call(content_item)
end

def breadcrumbs
breadcrumbs_based_on_ancestors
end
Expand Down Expand Up @@ -88,10 +84,6 @@ def content_is_a_html_publication?
content_item["document_type"] == "html_publication"
end

def content_has_a_topic?
content_item.dig("links", "topics").present?
end

def content_tagged_to_current_step_by_step?
# TODO: remove indirection here
step_nav_helper.show_header?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class RelatedNavigationHelper
MAX_SECTION_LENGTH = 5
DEFINED_SECTIONS = %w[
related_guides
topics
collections
topical_events
world_locations
Expand All @@ -32,7 +31,6 @@ def related_navigation_contents
}
when :footer
{
"topics" => related_topics_or_taxons,
"topical_events" => related_topical_events,
"world_locations" => related_world_locations,
"statistical_data_sets" => related_statistical_data_sets,
Expand All @@ -44,7 +42,6 @@ def related_navigation_contents
"related_items" => related_items,
"related_guides" => related_guides,
"collections" => related_document_collections,
"topics" => related_topics_or_taxons,
"topical_events" => related_topical_events,
"world_locations" => related_world_locations,
"statistical_data_sets" => related_statistical_data_sets,
Expand Down Expand Up @@ -142,28 +139,6 @@ def related_taxons
@related_taxons ||= content_item_links_for("taxons", only: "taxon")
end

def related_topics_or_taxons
return related_topics if related_topics.any?
return related_taxons if related_taxons.any?

[]
end

def related_topics
@related_topics ||= begin
mainstream_browse_page_links = content_item_links_for("mainstream_browse_pages", only: "mainstream_browse_page")
topic_links = content_item_links_for("topics", only: "topic")

return topic_links if topic_links.present? && mainstream_browse_page_links.empty?

mainstream_browse_page_links + topic_links.find_all do |topic_link|
mainstream_browse_page_links.none? do |mainstream_browse_page_link|
mainstream_browse_page_link[:text] == topic_link[:text]
end
end
end
end

def related_topical_events
content_item_links_for("topical_events", only: "topical_event")
end
Expand Down
4 changes: 2 additions & 2 deletions spec/components/breadcrumbs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ def assert_link_with_text_in(selector, link, text)
it "renders breadcrumb items without link as text" do
render_component(
breadcrumbs: [
{ title: "Topic", url: "/topic" },
{ title: "Education", url: "/education" },
{ title: "Current Page" },
],
)

assert_link_with_text_in(".govuk-breadcrumbs__list-item:first-child", "/topic", "Topic")
assert_link_with_text_in(".govuk-breadcrumbs__list-item:first-child", "/education", "Education")
assert_select(".govuk-breadcrumbs__list-item:last-child", "Current Page")
assert_select(".govuk-breadcrumbs__list-item:last-child a", false)
end
Expand Down
6 changes: 0 additions & 6 deletions spec/components/contextual_breadcrumbs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ def remove_curated_related_item(content_item)
content_item
end

def remove_topics(content_item)
content_item["links"].delete("topics")
content_item
end

def set_parent_titles_to_businesses(content_item)
content_item["links"]["parent"][0]["title"] = "Business and self-employed"
content_item["links"]["parent"][0]["links"]["parent"][0]["title"] = "Licences and licence applications"
Expand Down Expand Up @@ -86,7 +81,6 @@ def set_live_taxons(content_item)
it "renders taxon breadcrumbs if the content_item is tagged to mainstream browse but there is no mainstream browse parent" do
content_item = example_document_for("guide", "guide-with-no-parent")
content_item = set_live_taxons(content_item)
remove_topics(content_item)
render_component(content_item:)
assert_no_selector(".gem-c-step-nav-header")
assert_select "a", text: "Home"
Expand Down
12 changes: 6 additions & 6 deletions spec/components/contextual_footer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ def component_name
it "sets the GA4 type to \"contextual footer\"" do
content_item = {}
content_item["links"] = {
"topics" => [
"taxons" => [
{
"base_path" => "/skating",
"title" => "Skating",
"document_type" => "topic",
"document_type" => "taxon",
},
{
"base_path" => "/paragliding",
"title" => "Paragliding",
"document_type" => "topic",
"document_type" => "taxon",
},
],
}
Expand All @@ -55,16 +55,16 @@ def component_name
it "allows GA4 to be disabled" do
content_item = {}
content_item["links"] = {
"topics" => [
"taxons" => [
{
"base_path" => "/skating",
"title" => "Skating",
"document_type" => "topic",
"document_type" => "taxon",
},
{
"base_path" => "/paragliding",
"title" => "Paragliding",
"document_type" => "topic",
"document_type" => "taxon",
},
],
}
Expand Down
Loading
Loading