Skip to content

Commit

Permalink
Merge pull request #285 from alphagov/show-breadcrumbs-on-non-live-ta…
Browse files Browse the repository at this point in the history
…xons

Show breadcrumbs on non live taxons
  • Loading branch information
cbaines authored May 3, 2018
2 parents 8b8f3e7 + 078a4c7 commit 0d0c244
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,10 @@ def initialize(content_item)
end

def parent_taxon
parent_taxons.first
end
@_parent_taxon ||= begin
parent_content_item = content_item.dig("links", "parent_taxons", 0)

def parent_taxons
@_parent_taxons ||= begin
content_item.dig("links", "parent_taxons")
.to_a
.select { |t| phase_is_live?(t) }
.map { |taxon| ContentItem.new(taxon) }.sort_by(&:title)
ContentItem.new(parent_content_item) unless parent_content_item.nil?
end
end

Expand Down

0 comments on commit 0d0c244

Please sign in to comment.