Sha256: 14cf978ec0793e9950560a8668bb1e11d7db63ee781bb9f7fe779b3784f9f92d

Contents?: true

Size: 807 Bytes

Versions: 4

Compression:

Stored size: 807 Bytes

Contents

module GovukPublishingComponents
  module Presenters
    # @private
    class NavigationType
      def initialize(content_item)
        @content_item = content_item
      end

      def should_present_taxonomy_navigation?
        @content_item.dig("document_type") != "travel_advice" &&
        !content_is_tagged_to_browse_pages? &&
          content_is_tagged_to_a_live_taxon?
      end

    private

      def content_is_tagged_to_a_live_taxon?
        @content_item.dig("links", "taxons").to_a.any? { |taxon| taxon["phase"] == "live" }
      end

      def content_is_tagged_to_browse_pages?
        @content_item.dig("links", "mainstream_browse_pages").present?
      end

      def content_schema_is_guidance?
        GUIDANCE_SCHEMAS.include? @content_item["schema_name"]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
govuk_publishing_components-6.5.0 lib/govuk_publishing_components/presenters/navigation_type.rb
govuk_publishing_components-6.4.0 lib/govuk_publishing_components/presenters/navigation_type.rb
govuk_publishing_components-6.3.0 lib/govuk_publishing_components/presenters/navigation_type.rb
govuk_publishing_components-6.2.0 lib/govuk_publishing_components/presenters/navigation_type.rb