Sha256: ca90d8e2ae357032c3f77ebe10aea51d6eca0421873db1f2d508eaa37a90b9ac
Contents?: true
Size: 905 Bytes
Versions: 3
Compression:
Stored size: 905 Bytes
Contents
module GovukPublishingComponents module Presenters # @private class ContentBreadcrumbsBasedOnOrganisations def self.call(content_item) new(content_item).breadcrumbs end def initialize(content_item) @content_item = ContentItem.new(content_item) end def breadcrumbs [ { title: "Home", url: "/" }, { title: "Organisations", url: "/government/organisations" }, *organisation_breadcrumbs_items, ] end private attr_reader :content_item def organisation_breadcrumbs_items first_related_organisation = ContentItem.new(content_item.related_organisations.first) return [] unless first_related_organisation.present? [{ title: first_related_organisation.title, url: first_related_organisation.base_path, }] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems