diff --git a/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb b/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb index 34a15f693a..e301df2e35 100644 --- a/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +++ b/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb @@ -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, diff --git a/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_topic.rb b/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_topic.rb deleted file mode 100644 index a8c46d7f6c..0000000000 --- a/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_topic.rb +++ /dev/null @@ -1,38 +0,0 @@ -module GovukPublishingComponents - module Presenters - class ContentBreadcrumbsBasedOnTopic - def self.call(content_item) - new(content_item).breadcrumbs - end - - attr_reader :content_item - - def initialize(content_item) - @content_item = content_item - end - - def breadcrumbs - breadcrumbs = [{ title: "Home", url: "/" }] - return breadcrumbs unless topics.present? - - breadcrumbs << topic_breadcrumb - breadcrumbs - end - - def topic_breadcrumb - { - title: first_topic["title"], - url: first_topic["base_path"], - } - end - - def first_topic - topics.first - end - - def topics - @topics ||= content_item.dig("links", "topics") - end - end - end -end diff --git a/lib/govuk_publishing_components/presenters/contextual_navigation.rb b/lib/govuk_publishing_components/presenters/contextual_navigation.rb index 4413fe6301..419d850480 100644 --- a/lib/govuk_publishing_components/presenters/contextual_navigation.rb +++ b/lib/govuk_publishing_components/presenters/contextual_navigation.rb @@ -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 @@ -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? diff --git a/spec/components/breadcrumbs_spec.rb b/spec/components/breadcrumbs_spec.rb index 85c003c66e..3955e4069a 100644 --- a/spec/components/breadcrumbs_spec.rb +++ b/spec/components/breadcrumbs_spec.rb @@ -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 diff --git a/spec/components/contextual_breadcrumbs_spec.rb b/spec/components/contextual_breadcrumbs_spec.rb index 6f2009dadc..1fe0851c5f 100644 --- a/spec/components/contextual_breadcrumbs_spec.rb +++ b/spec/components/contextual_breadcrumbs_spec.rb @@ -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" @@ -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" diff --git a/spec/components/contextual_footer_spec.rb b/spec/components/contextual_footer_spec.rb index 740b441c6c..87f2cc3537 100644 --- a/spec/components/contextual_footer_spec.rb +++ b/spec/components/contextual_footer_spec.rb @@ -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", }, ], } @@ -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", }, ], }