govuk_publishing_components 5.7.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +6 -19
- data/app/assets/stylesheets/govuk_publishing_components/components/_label.scss +7 -0
- data/app/views/govuk_publishing_components/components/_input.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/docs/input.yml +2 -0
- data/app/views/govuk_publishing_components/components/docs/label.yml +10 -2
- data/lib/govuk_publishing_components.rb +11 -6
- data/lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb +81 -0
- data/lib/govuk_publishing_components/presenters/breadcrumbs.rb +39 -0
- data/lib/govuk_publishing_components/presenters/content_item.rb +156 -0
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +5 -13
- data/lib/govuk_publishing_components/presenters/curated_taxonomy_sidebar_links.rb +99 -0
- data/lib/govuk_publishing_components/presenters/rummager_taxonomy_sidebar_links.rb +62 -0
- data/lib/govuk_publishing_components/presenters/services.rb +12 -0
- data/lib/govuk_publishing_components/{app_helpers → presenters}/step_nav_helper.rb +35 -2
- data/lib/govuk_publishing_components/presenters/taxon_breadcrumbs.rb +46 -0
- data/lib/govuk_publishing_components/presenters/taxonomy_sidebar.rb +47 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +25 -18
- data/lib/govuk_publishing_components/app_helpers/step_nav.rb +0 -33
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e25ba48b6617e7a2bdabcb5bdc0e4619f722377f6e0746e3427f0494bfed2d91
         | 
| 4 | 
            +
              data.tar.gz: e7f00227e7eb544f5a8361ecb0c2f5d5f52440d79ec346ef72f019c6dfb3c6fb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1dc324718d91df1fa4d7ab6bafcf56ee93c542f0535b2ec736af19a24fead4564b6aa23275d7d70a3a3b5e70ffd346a209da2e5655f9b01407a85eccbf6e1c64
         | 
| 7 | 
            +
              data.tar.gz: ab26b2dec0f31316062ffe67964b8cbcdf1b9274b2349895cf7314505fd61c7977fc35d7a0120a4373fae15a0c729fd14e41da4f178be1030b39239ed8a1ba1a
         | 
| @@ -22,26 +22,13 @@ input[type=text].gem-c-input { | |
| 22 22 |  | 
| 23 23 | 
             
              // Disable inner shadow and remove rounded corners
         | 
| 24 24 | 
             
              appearance: none;
         | 
| 25 | 
            -
            }
         | 
| 26 | 
            -
            // scss-lint:enable QualifyingElement
         | 
| 27 25 |  | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
                margin-bottom: 30px;
         | 
| 26 | 
            +
              &.gem-c-input:focus {
         | 
| 27 | 
            +
                outline: $gem-focus-width solid $gem-focus-colour;
         | 
| 31 28 | 
             
              }
         | 
| 32 | 
            -
            }
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            .gem-c-input:focus {
         | 
| 35 | 
            -
              outline: $gem-focus-width solid $gem-focus-colour;
         | 
| 36 | 
            -
            }
         | 
| 37 29 |  | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
            }
         | 
| 41 | 
            -
             | 
| 42 | 
            -
            // Replace this with the error message component.
         | 
| 43 | 
            -
            .gem-c-input__label-error {
         | 
| 44 | 
            -
              font-weight: bold;
         | 
| 45 | 
            -
              color: $gem-error-colour;
         | 
| 46 | 
            -
              padding-top: 4px;
         | 
| 30 | 
            +
              &.gem-c-input--error {
         | 
| 31 | 
            +
                border: $gem-border-width-error solid $gem-error-colour;
         | 
| 32 | 
            +
              }
         | 
| 47 33 | 
             
            }
         | 
| 34 | 
            +
            // scss-lint:enable QualifyingElement
         | 
| @@ -13,6 +13,8 @@ accessibility_criteria: | | |
| 13 13 | 
             
              * be recognisable as form input elements
         | 
| 14 14 | 
             
              * have correctly associated labels
         | 
| 15 15 | 
             
              * be of the appropriate type for their use, e.g. password inputs should be of type 'password'
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              Labels use the [label component](/component-guide/label).
         | 
| 16 18 | 
             
            examples:
         | 
| 17 19 | 
             
              default:
         | 
| 18 20 | 
             
                data:
         | 
| @@ -5,9 +5,17 @@ body: | | |
| 5 5 |  | 
| 6 6 | 
             
              Forked from the upcoming [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend), when GOV.UK Frontend release we can replace these source files.
         | 
| 7 7 | 
             
            accessibility_criteria: |
         | 
| 8 | 
            -
               | 
| 8 | 
            +
              All text must have a contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast)
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              Labels must:
         | 
| 11 | 
            +
             | 
| 9 12 | 
             
              - have visible text
         | 
| 10 | 
            -
             | 
| 13 | 
            +
             | 
| 14 | 
            +
              Hint text must:
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              - be associated with an input. The `hint_id` must match the `aria-describedby` property on the input your label is associated with.
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              If hint text is within a label it will be announced in its entirity by screen readers. By putting the hint alongside labels and associating hints with inputs using `aria-describedby`, then screen readers will read the label, describe the type of input (eg radio) and then read additional text. It means users of screen readers can scan and skip options as easy as people making choices with sight. [A discussion of this approach](https://github.com/alphagov/govuk_elements/issues/574).
         | 
| 11 19 | 
             
            examples:
         | 
| 12 20 | 
             
              default:
         | 
| 13 21 | 
             
                data:
         | 
| @@ -1,14 +1,19 @@ | |
| 1 1 | 
             
            require "govuk_publishing_components/config"
         | 
| 2 2 | 
             
            require "govuk_publishing_components/engine"
         | 
| 3 | 
            -
            require "govuk_publishing_components/presenters/step_by_step_nav_helper"
         | 
| 4 | 
            -
            require "govuk_publishing_components/presenters/related_navigation_helper"
         | 
| 5 3 | 
             
            require "govuk_publishing_components/presenters/contextual_navigation"
         | 
| 6 4 | 
             
            require "govuk_publishing_components/presenters/navigation_type"
         | 
| 5 | 
            +
            require "govuk_publishing_components/presenters/related_navigation_helper"
         | 
| 6 | 
            +
            require "govuk_publishing_components/presenters/step_by_step_nav_helper"
         | 
| 7 | 
            +
            require "govuk_publishing_components/presenters/step_nav_helper"
         | 
| 8 | 
            +
            require "govuk_publishing_components/presenters/breadcrumbs"
         | 
| 9 | 
            +
            require "govuk_publishing_components/presenters/taxon_breadcrumbs"
         | 
| 10 | 
            +
            require "govuk_publishing_components/presenters/services"
         | 
| 11 | 
            +
            require "govuk_publishing_components/presenters/taxonomy_sidebar"
         | 
| 12 | 
            +
            require "govuk_publishing_components/presenters/rummager_taxonomy_sidebar_links"
         | 
| 13 | 
            +
            require "govuk_publishing_components/presenters/curated_taxonomy_sidebar_links"
         | 
| 14 | 
            +
            require "govuk_publishing_components/presenters/content_item"
         | 
| 7 15 |  | 
| 8 | 
            -
            require "govuk_publishing_components/app_helpers/ | 
| 9 | 
            -
            require "govuk_publishing_components/app_helpers/step_nav_helper"
         | 
| 16 | 
            +
            require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
         | 
| 10 17 |  | 
| 11 18 | 
             
            module GovukPublishingComponents
         | 
| 12 | 
            -
              StepNavHelper = GovukPublishingComponents::AppHelpers::StepNavHelper
         | 
| 13 | 
            -
              StepNav = GovukPublishingComponents::AppHelpers::StepNav
         | 
| 14 19 | 
             
            end
         | 
| @@ -0,0 +1,81 @@ | |
| 1 | 
            +
            module GovukPublishingComponents
         | 
| 2 | 
            +
              module AppHelpers
         | 
| 3 | 
            +
                class TaxonBreadcrumbs
         | 
| 4 | 
            +
                  # @param content_item A taxon
         | 
| 5 | 
            +
                  def initialize(content_item)
         | 
| 6 | 
            +
                    @content_item = TaxonBreadcrumbs::ContentItem.new(content_item)
         | 
| 7 | 
            +
                  end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  # Generate a breadcrumb trail for a taxon, using the taxon_parent link field
         | 
| 10 | 
            +
                  #
         | 
| 11 | 
            +
                  # @return [Hash] Payload for the GOV.UK breadcrumbs component
         | 
| 12 | 
            +
                  # @see https://govuk-component-guide.herokuapp.com/components/breadcrumbs
         | 
| 13 | 
            +
                  def breadcrumbs
         | 
| 14 | 
            +
                    ordered_parents = all_parents.map.with_index do |parent, index|
         | 
| 15 | 
            +
                      {
         | 
| 16 | 
            +
                        title: parent.title,
         | 
| 17 | 
            +
                        url: parent.base_path,
         | 
| 18 | 
            +
                        is_page_parent: index.zero?
         | 
| 19 | 
            +
                      }
         | 
| 20 | 
            +
                    end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    ordered_parents << {
         | 
| 23 | 
            +
                      title: "Home",
         | 
| 24 | 
            +
                      url: "/",
         | 
| 25 | 
            +
                      is_page_parent: ordered_parents.empty?
         | 
| 26 | 
            +
                    }
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    ordered_parents.reverse
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                private
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  attr_reader :content_item
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  def all_parents
         | 
| 36 | 
            +
                    parents = []
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                    direct_parent = content_item.parent_taxon
         | 
| 39 | 
            +
                    while direct_parent
         | 
| 40 | 
            +
                      parents << direct_parent
         | 
| 41 | 
            +
                      direct_parent = direct_parent.parent_taxon
         | 
| 42 | 
            +
                    end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                    parents
         | 
| 45 | 
            +
                  end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                  class ContentItem
         | 
| 48 | 
            +
                    attr_reader :content_item
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    def initialize(content_item)
         | 
| 51 | 
            +
                      @content_item = content_item
         | 
| 52 | 
            +
                    end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                    def parent_taxon
         | 
| 55 | 
            +
                      parent_taxons.first
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                    def parent_taxons
         | 
| 59 | 
            +
                      @_parent_taxons ||= begin
         | 
| 60 | 
            +
                        content_item.dig("links", "parent_taxons")
         | 
| 61 | 
            +
                          .to_a
         | 
| 62 | 
            +
                          .select { |t| phase_is_live?(t) }
         | 
| 63 | 
            +
                          .map { |taxon| ContentItem.new(taxon) }.sort_by(&:title)
         | 
| 64 | 
            +
                      end
         | 
| 65 | 
            +
                    end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                    def phase_is_live?(taxon)
         | 
| 68 | 
            +
                      taxon["phase"] == "live"
         | 
| 69 | 
            +
                    end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                    def title
         | 
| 72 | 
            +
                      content_item.fetch("title")
         | 
| 73 | 
            +
                    end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                    def base_path
         | 
| 76 | 
            +
                      content_item.fetch("base_path")
         | 
| 77 | 
            +
                    end
         | 
| 78 | 
            +
                  end
         | 
| 79 | 
            +
                end
         | 
| 80 | 
            +
              end
         | 
| 81 | 
            +
            end
         | 
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            module GovukPublishingComponents
         | 
| 2 | 
            +
              module Presenters
         | 
| 3 | 
            +
                # @private
         | 
| 4 | 
            +
                class Breadcrumbs
         | 
| 5 | 
            +
                  def initialize(content_item)
         | 
| 6 | 
            +
                    @content_item = ContentItem.new(content_item)
         | 
| 7 | 
            +
                  end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  def breadcrumbs
         | 
| 10 | 
            +
                    ordered_parents = all_parents.map do |parent|
         | 
| 11 | 
            +
                      { title: parent.title, url: parent.base_path }
         | 
| 12 | 
            +
                    end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    ordered_parents << { title: "Home", url: "/" }
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                    {
         | 
| 17 | 
            +
                      breadcrumbs: ordered_parents.reverse
         | 
| 18 | 
            +
                    }
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                private
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  attr_reader :content_item
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  def all_parents
         | 
| 26 | 
            +
                    parents = []
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    direct_parent = content_item.parent
         | 
| 29 | 
            +
                    while direct_parent
         | 
| 30 | 
            +
                      parents << direct_parent
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                      direct_parent = direct_parent.parent
         | 
| 33 | 
            +
                    end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                    parents
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
| @@ -0,0 +1,156 @@ | |
| 1 | 
            +
            module GovukPublishingComponents
         | 
| 2 | 
            +
              module Presenters
         | 
| 3 | 
            +
                # Simple wrapper around a content store representation of a content item.
         | 
| 4 | 
            +
                # Works for both the main content item and the expanded links in the links
         | 
| 5 | 
            +
                # hash.
         | 
| 6 | 
            +
                #
         | 
| 7 | 
            +
                # @private
         | 
| 8 | 
            +
                class ContentItem
         | 
| 9 | 
            +
                  attr_reader :content_store_response
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def initialize(content_store_response)
         | 
| 12 | 
            +
                    @content_store_response = content_store_response.to_h
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  def parent
         | 
| 16 | 
            +
                    parent_item = content_store_response.dig("links", "parent", 0)
         | 
| 17 | 
            +
                    return unless parent_item
         | 
| 18 | 
            +
                    ContentItem.new(parent_item)
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  def parent_taxon
         | 
| 22 | 
            +
                    # TODO: Determine what to do when there are multiple taxons/parents. For
         | 
| 23 | 
            +
                    # now just display the first of each.
         | 
| 24 | 
            +
                    parent_taxons.sort_by(&:title).first
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  def parent_taxons
         | 
| 28 | 
            +
                    @_parent_taxons ||= begin
         | 
| 29 | 
            +
                      taxon_links
         | 
| 30 | 
            +
                        .select { |t| phase_is_live?(t) }
         | 
| 31 | 
            +
                        .map { |taxon| ContentItem.new(taxon) }.sort_by(&:title)
         | 
| 32 | 
            +
                    end
         | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  def phase_is_live?(taxon)
         | 
| 36 | 
            +
                    taxon["phase"] == "live"
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                  def mainstream_browse_pages
         | 
| 40 | 
            +
                    content_store_response.dig("links", "mainstream_browse_pages").to_a.map do |link|
         | 
| 41 | 
            +
                      ContentItem.new(link)
         | 
| 42 | 
            +
                    end
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  def title
         | 
| 46 | 
            +
                    content_store_response.fetch("title")
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                  def base_path
         | 
| 50 | 
            +
                    content_store_response.fetch("base_path")
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                  def description
         | 
| 54 | 
            +
                    content_store_response.fetch("description", "")
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                  def content_id
         | 
| 58 | 
            +
                    content_store_response.fetch("content_id")
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                  def related_links
         | 
| 62 | 
            +
                    content_store_response.dig("links", "ordered_related_items").to_a.map do |link|
         | 
| 63 | 
            +
                      ContentItem.new(link)
         | 
| 64 | 
            +
                    end
         | 
| 65 | 
            +
                  end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                  def curated_taxonomy_sidebar_links
         | 
| 68 | 
            +
                    content_store_response.dig("links", "ordered_related_items_overrides").to_a.map do |link|
         | 
| 69 | 
            +
                      ContentItem.new(link)
         | 
| 70 | 
            +
                    end
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                  def related_ordered_items
         | 
| 74 | 
            +
                    content_store_response.dig("links", "ordered_related_items").to_a
         | 
| 75 | 
            +
                  end
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                  def quick_links
         | 
| 78 | 
            +
                    content_store_response.dig("details", "quick_links").to_a
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  def related_collections
         | 
| 82 | 
            +
                    filter_link_type(content_store_response.dig("links", "document_collections").to_a, "document_collection")
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                  def related_other_contacts
         | 
| 86 | 
            +
                    filter_link_type(content_store_response.dig("links", "related").to_a, "contact")
         | 
| 87 | 
            +
                  end
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                  def related_organisations
         | 
| 90 | 
            +
                    filter_link_type(content_store_response.dig("links", "organisations").to_a, "organisation")
         | 
| 91 | 
            +
                  end
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                  def related_policies
         | 
| 94 | 
            +
                    filter_link_type(content_store_response.dig("links", "related_policies").to_a, "policy")
         | 
| 95 | 
            +
                  end
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                  def related_statistical_data_sets
         | 
| 98 | 
            +
                    filter_link_type(content_store_response.dig("links", "related_statistical_data_sets").to_a, "statistical_data_set")
         | 
| 99 | 
            +
                  end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                  def related_topics
         | 
| 102 | 
            +
                    filter_link_type(content_store_response.dig("links", "topics").to_a, "topic")
         | 
| 103 | 
            +
                  end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                  def related_topical_events
         | 
| 106 | 
            +
                    filter_link_type(content_store_response.dig("links", "topical_events").to_a, "topical_event")
         | 
| 107 | 
            +
                  end
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                  def related_world_locations
         | 
| 110 | 
            +
                    content_store_response.dig("links", "world_locations").to_a
         | 
| 111 | 
            +
                  end
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                  def related_worldwide_organisations
         | 
| 114 | 
            +
                    filter_link_type(content_store_response.dig("links", "worldwide_organisations").to_a, "worldwide_organisation")
         | 
| 115 | 
            +
                  end
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                  def external_links
         | 
| 118 | 
            +
                    content_store_response.dig("details", "external_related_links").to_a
         | 
| 119 | 
            +
                  end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                  def as_taxonomy_sidebar_link
         | 
| 122 | 
            +
                    {
         | 
| 123 | 
            +
                      title: title,
         | 
| 124 | 
            +
                      link: base_path,
         | 
| 125 | 
            +
                    }
         | 
| 126 | 
            +
                  end
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                  def ==(other)
         | 
| 129 | 
            +
                    content_id == other.content_id
         | 
| 130 | 
            +
                  end
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                  def hash
         | 
| 133 | 
            +
                    content_id.hash
         | 
| 134 | 
            +
                  end
         | 
| 135 | 
            +
             | 
| 136 | 
            +
                  def eql?(other)
         | 
| 137 | 
            +
                    self == other
         | 
| 138 | 
            +
                  end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
                private
         | 
| 141 | 
            +
             | 
| 142 | 
            +
                  def taxon_links
         | 
| 143 | 
            +
                    # A normal content item's taxon links are stored in ["links"]["taxons"]
         | 
| 144 | 
            +
                    # whereas a Taxon content item's taxon links are stored in ["links"]["parent_taxons"]
         | 
| 145 | 
            +
                    # so here we cater for both possibilities
         | 
| 146 | 
            +
                    content_store_response.dig("links", "taxons") || content_store_response.dig("links", "parent_taxons") || []
         | 
| 147 | 
            +
                  end
         | 
| 148 | 
            +
             | 
| 149 | 
            +
                  def filter_link_type(links, type)
         | 
| 150 | 
            +
                    links.select do |link|
         | 
| 151 | 
            +
                      link["document_type"] == type
         | 
| 152 | 
            +
                    end
         | 
| 153 | 
            +
                  end
         | 
| 154 | 
            +
                end
         | 
| 155 | 
            +
              end
         | 
| 156 | 
            +
            end
         | 
| @@ -1,5 +1,3 @@ | |
| 1 | 
            -
            require 'govuk_navigation_helpers'
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            module GovukPublishingComponents
         | 
| 4 2 | 
             
              module Presenters
         | 
| 5 3 | 
             
                # @private
         | 
| @@ -14,11 +12,11 @@ module GovukPublishingComponents | |
| 14 12 | 
             
                  end
         | 
| 15 13 |  | 
| 16 14 | 
             
                  def taxonomy_sidebar
         | 
| 17 | 
            -
                     | 
| 15 | 
            +
                    @taxonomy_sidebar ||= TaxonomySidebar.new(content_item).sidebar
         | 
| 18 16 | 
             
                  end
         | 
| 19 17 |  | 
| 20 18 | 
             
                  def taxon_breadcrumbs
         | 
| 21 | 
            -
                     | 
| 19 | 
            +
                    @taxon_breadcrumbs ||= TaxonBreadcrumbs.new(content_item).breadcrumbs
         | 
| 22 20 | 
             
                  end
         | 
| 23 21 |  | 
| 24 22 | 
             
                  def breadcrumbs
         | 
| @@ -37,23 +35,17 @@ module GovukPublishingComponents | |
| 37 35 | 
             
                        }
         | 
| 38 36 | 
             
                      ]
         | 
| 39 37 | 
             
                    else
         | 
| 40 | 
            -
                       | 
| 38 | 
            +
                      Breadcrumbs.new(content_item).breadcrumbs[:breadcrumbs]
         | 
| 41 39 | 
             
                    end
         | 
| 42 40 | 
             
                  end
         | 
| 43 41 |  | 
| 44 42 | 
             
                  def should_present_taxonomy_navigation?
         | 
| 45 | 
            -
                    navigation =  | 
| 43 | 
            +
                    navigation = NavigationType.new(content_item)
         | 
| 46 44 | 
             
                    navigation.should_present_taxonomy_navigation?
         | 
| 47 45 | 
             
                  end
         | 
| 48 46 |  | 
| 49 47 | 
             
                  def step_nav_helper
         | 
| 50 | 
            -
                    @step_nav_helper ||=  | 
| 51 | 
            -
                  end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                private
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                  def nav_helper
         | 
| 56 | 
            -
                    @nav_helper ||= GovukNavigationHelpers::NavigationHelper.new(content_item)
         | 
| 48 | 
            +
                    @step_nav_helper ||= StepNavHelper.new(content_item, request_path)
         | 
| 57 49 | 
             
                  end
         | 
| 58 50 | 
             
                end
         | 
| 59 51 | 
             
              end
         | 
| @@ -0,0 +1,99 @@ | |
| 1 | 
            +
            require 'set'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module GovukPublishingComponents
         | 
| 4 | 
            +
              module Presenters
         | 
| 5 | 
            +
                # @private
         | 
| 6 | 
            +
                class CuratedTaxonomySidebarLinks
         | 
| 7 | 
            +
                  def initialize(content_item)
         | 
| 8 | 
            +
                    @content_item = content_item
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def related_items
         | 
| 12 | 
            +
                    @related_items ||=
         | 
| 13 | 
            +
                      taxon_links +
         | 
| 14 | 
            +
                      elsewhere_on_gov_uk_links +
         | 
| 15 | 
            +
                      elsewhere_on_the_web_links
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                private
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  def taxon_links
         | 
| 21 | 
            +
                    @content_item.parent_taxons.map do |taxon|
         | 
| 22 | 
            +
                      {
         | 
| 23 | 
            +
                        title: taxon.title,
         | 
| 24 | 
            +
                        url: taxon.base_path,
         | 
| 25 | 
            +
                        description: taxon.description,
         | 
| 26 | 
            +
                        related_content: format_for_sidebar(related_content_by_taxon[taxon]),
         | 
| 27 | 
            +
                      }
         | 
| 28 | 
            +
                    end
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  def elsewhere_on_gov_uk_links
         | 
| 32 | 
            +
                    elsewhere_items = related_content_elsewhere_on_govuk
         | 
| 33 | 
            +
                    return [] if elsewhere_items.empty?
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                    [
         | 
| 36 | 
            +
                      {
         | 
| 37 | 
            +
                        title: 'Elsewhere on GOV.UK',
         | 
| 38 | 
            +
                        related_content: format_for_sidebar(elsewhere_items),
         | 
| 39 | 
            +
                      },
         | 
| 40 | 
            +
                    ]
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  def elsewhere_on_the_web_links
         | 
| 44 | 
            +
                    return [] if @content_item.external_links.empty?
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                    external_links = @content_item.external_links.map do |link|
         | 
| 47 | 
            +
                      {
         | 
| 48 | 
            +
                        title: link['title'],
         | 
| 49 | 
            +
                        link: link['url'],
         | 
| 50 | 
            +
                      }
         | 
| 51 | 
            +
                    end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                    [
         | 
| 54 | 
            +
                      {
         | 
| 55 | 
            +
                        title: 'Elsewhere on the web',
         | 
| 56 | 
            +
                        related_content: external_links,
         | 
| 57 | 
            +
                      },
         | 
| 58 | 
            +
                    ]
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                  def related_content_by_taxon
         | 
| 62 | 
            +
                    @related_items_by_taxon ||= begin
         | 
| 63 | 
            +
                      curated_related_items = @content_item.curated_taxonomy_sidebar_links.to_set
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                      @content_item.parent_taxons.each_with_object({}) do |taxon, items_by_taxon|
         | 
| 66 | 
            +
                        items_related_to_taxon = filter_items_by_taxon(curated_related_items, taxon)
         | 
| 67 | 
            +
                        items_by_taxon[taxon] = items_related_to_taxon
         | 
| 68 | 
            +
                        curated_related_items = undisplayed_items(curated_related_items, items_related_to_taxon)
         | 
| 69 | 
            +
                      end
         | 
| 70 | 
            +
                    end
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                  def related_content_elsewhere_on_govuk
         | 
| 74 | 
            +
                    @related_content_elsewhere_on_govuk ||= begin
         | 
| 75 | 
            +
                      related_content = @content_item.curated_taxonomy_sidebar_links.to_set
         | 
| 76 | 
            +
                      related_taxon_content = related_content_by_taxon.values.flatten.to_set
         | 
| 77 | 
            +
                      related_content - related_taxon_content
         | 
| 78 | 
            +
                    end
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  def filter_items_by_taxon(items, taxon)
         | 
| 82 | 
            +
                    items.select do |item|
         | 
| 83 | 
            +
                      item.parent_taxons.include?(taxon)
         | 
| 84 | 
            +
                    end
         | 
| 85 | 
            +
                  end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                  def undisplayed_items(all_items, displayed_items)
         | 
| 88 | 
            +
                    all_items - displayed_items
         | 
| 89 | 
            +
                  end
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                  def format_for_sidebar(collection)
         | 
| 92 | 
            +
                    collection
         | 
| 93 | 
            +
                      .to_a
         | 
| 94 | 
            +
                      .sort_by(&:title)
         | 
| 95 | 
            +
                      .map(&:as_taxonomy_sidebar_link)
         | 
| 96 | 
            +
                  end
         | 
| 97 | 
            +
                end
         | 
| 98 | 
            +
              end
         | 
| 99 | 
            +
            end
         | 
| @@ -0,0 +1,62 @@ | |
| 1 | 
            +
            require 'govuk_app_config'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module GovukPublishingComponents
         | 
| 4 | 
            +
              module Presenters
         | 
| 5 | 
            +
                # @private
         | 
| 6 | 
            +
                class RummagerTaxonomySidebarLinks
         | 
| 7 | 
            +
                  def initialize(content_item)
         | 
| 8 | 
            +
                    @content_item = content_item
         | 
| 9 | 
            +
                  end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def related_items
         | 
| 12 | 
            +
                    parent_taxons = @content_item.parent_taxons
         | 
| 13 | 
            +
                    used_related_links = Set.new
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    parent_taxons.each_with_index.map do |parent_taxon, index|
         | 
| 16 | 
            +
                      related_content = index < 2 ? content_related_to(parent_taxon, used_related_links) : []
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                      used_related_links.merge(
         | 
| 19 | 
            +
                        related_content.map { |content| content[:link] }
         | 
| 20 | 
            +
                      )
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      {
         | 
| 23 | 
            +
                        title: parent_taxon.title,
         | 
| 24 | 
            +
                        url: parent_taxon.base_path,
         | 
| 25 | 
            +
                        description: parent_taxon.description,
         | 
| 26 | 
            +
                        related_content: related_content,
         | 
| 27 | 
            +
                      }
         | 
| 28 | 
            +
                    end
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                private
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  # This method will fetch content related to content_item, and tagged to taxon. This is a
         | 
| 34 | 
            +
                  # temporary method that uses search to achieve this. This behaviour is to be moved into
         | 
| 35 | 
            +
                  # the content store
         | 
| 36 | 
            +
                  def content_related_to(taxon, used_related_links)
         | 
| 37 | 
            +
                    GovukStatsd.time(:taxonomy_sidebar_search_time) do
         | 
| 38 | 
            +
                      begin
         | 
| 39 | 
            +
                        results = Services.rummager.search(
         | 
| 40 | 
            +
                          similar_to: @content_item.base_path,
         | 
| 41 | 
            +
                          start: 0,
         | 
| 42 | 
            +
                          count: 3,
         | 
| 43 | 
            +
                          filter_taxons: [taxon.content_id],
         | 
| 44 | 
            +
                          filter_navigation_document_supertype: 'guidance',
         | 
| 45 | 
            +
                          reject_link: used_related_links.to_a,
         | 
| 46 | 
            +
                          fields: %w[title link],
         | 
| 47 | 
            +
                        )['results']
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                        GovukStatsd.increment(:taxonomy_sidebar_searches)
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                        results
         | 
| 52 | 
            +
                          .map { |result| { title: result['title'], link: result['link'], } }
         | 
| 53 | 
            +
                          .sort_by { |result| result[:title] }
         | 
| 54 | 
            +
                      rescue StandardError => e
         | 
| 55 | 
            +
                        GovukError.notify(e)
         | 
| 56 | 
            +
                        []
         | 
| 57 | 
            +
                      end
         | 
| 58 | 
            +
                    end
         | 
| 59 | 
            +
                  end
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
              end
         | 
| 62 | 
            +
            end
         | 
| @@ -1,5 +1,7 @@ | |
| 1 1 | 
             
            module GovukPublishingComponents
         | 
| 2 | 
            -
              module  | 
| 2 | 
            +
              module Presenters
         | 
| 3 | 
            +
                # @private
         | 
| 4 | 
            +
                # Only used by the step by step component
         | 
| 3 5 | 
             
                class StepNavHelper
         | 
| 4 6 | 
             
                  def initialize(content_store_response, current_path)
         | 
| 5 7 | 
             
                    @content_item = content_store_response.to_h
         | 
| @@ -8,7 +10,7 @@ module GovukPublishingComponents | |
| 8 10 |  | 
| 9 11 | 
             
                  def step_navs
         | 
| 10 12 | 
             
                    @step_navs ||= parsed_step_navs.map do |step_nav|
         | 
| 11 | 
            -
                       | 
| 13 | 
            +
                      StepByStepModel.new(step_nav)
         | 
| 12 14 | 
             
                    end
         | 
| 13 15 | 
             
                  end
         | 
| 14 16 |  | 
| @@ -89,5 +91,36 @@ module GovukPublishingComponents | |
| 89 91 | 
             
                    step_nav_content
         | 
| 90 92 | 
             
                  end
         | 
| 91 93 | 
             
                end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                # @private
         | 
| 96 | 
            +
                class StepByStepModel
         | 
| 97 | 
            +
                  def initialize(content_item)
         | 
| 98 | 
            +
                    @content_item = content_item.deep_symbolize_keys
         | 
| 99 | 
            +
                  end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                  def title
         | 
| 102 | 
            +
                    content_item[:title]
         | 
| 103 | 
            +
                  end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                  def base_path
         | 
| 106 | 
            +
                    content_item[:base_path]
         | 
| 107 | 
            +
                  end
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                  def content_id
         | 
| 110 | 
            +
                    content_item[:content_id]
         | 
| 111 | 
            +
                  end
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                  def content
         | 
| 114 | 
            +
                    content_item.dig(:details, :step_by_step_nav)
         | 
| 115 | 
            +
                  end
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                  def steps
         | 
| 118 | 
            +
                    content_item.dig(:details, :step_by_step_nav, :steps)
         | 
| 119 | 
            +
                  end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                private
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                  attr_reader :content_item
         | 
| 124 | 
            +
                end
         | 
| 92 125 | 
             
              end
         | 
| 93 126 | 
             
            end
         | 
| @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            module GovukPublishingComponents
         | 
| 2 | 
            +
              module Presenters
         | 
| 3 | 
            +
                # @private
         | 
| 4 | 
            +
                class TaxonBreadcrumbs
         | 
| 5 | 
            +
                  def initialize(content_item)
         | 
| 6 | 
            +
                    @content_item = ContentItem.new(content_item)
         | 
| 7 | 
            +
                  end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  def breadcrumbs
         | 
| 10 | 
            +
                    ordered_parents = all_parents.map.with_index do |parent, index|
         | 
| 11 | 
            +
                      {
         | 
| 12 | 
            +
                        title: parent.title,
         | 
| 13 | 
            +
                        url: parent.base_path,
         | 
| 14 | 
            +
                        is_page_parent: index.zero?
         | 
| 15 | 
            +
                      }
         | 
| 16 | 
            +
                    end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                    ordered_parents << {
         | 
| 19 | 
            +
                      title: "Home",
         | 
| 20 | 
            +
                      url: "/",
         | 
| 21 | 
            +
                      is_page_parent: ordered_parents.empty?
         | 
| 22 | 
            +
                    }
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                    {
         | 
| 25 | 
            +
                      breadcrumbs: ordered_parents.reverse
         | 
| 26 | 
            +
                    }
         | 
| 27 | 
            +
                  end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                private
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  attr_reader :content_item
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  def all_parents
         | 
| 34 | 
            +
                    parents = []
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    direct_parent = content_item.parent_taxon
         | 
| 37 | 
            +
                    while direct_parent
         | 
| 38 | 
            +
                      parents << direct_parent
         | 
| 39 | 
            +
                      direct_parent = direct_parent.parent_taxon
         | 
| 40 | 
            +
                    end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    parents
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
                end
         | 
| 45 | 
            +
              end
         | 
| 46 | 
            +
            end
         | 
| @@ -0,0 +1,47 @@ | |
| 1 | 
            +
            module GovukPublishingComponents
         | 
| 2 | 
            +
              module Presenters
         | 
| 3 | 
            +
                # @private
         | 
| 4 | 
            +
                class TaxonomySidebar
         | 
| 5 | 
            +
                  def initialize(content_item)
         | 
| 6 | 
            +
                    @content_item = ContentItem.new content_item
         | 
| 7 | 
            +
                  end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  def sidebar
         | 
| 10 | 
            +
                    {
         | 
| 11 | 
            +
                      items: related_items,
         | 
| 12 | 
            +
                      collections: collections,
         | 
| 13 | 
            +
                    }
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                private
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  def there_are_related_item_overrides?
         | 
| 19 | 
            +
                    # TODO: We should check for any external links when we have "new"
         | 
| 20 | 
            +
                    # external links being curated in Content Tagger
         | 
| 21 | 
            +
                    @content_item.curated_taxonomy_sidebar_links.any?
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  def related_items
         | 
| 25 | 
            +
                    related_items_factory.new(@content_item).related_items
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  def related_items_factory
         | 
| 29 | 
            +
                    if there_are_related_item_overrides?
         | 
| 30 | 
            +
                      CuratedTaxonomySidebarLinks
         | 
| 31 | 
            +
                    else
         | 
| 32 | 
            +
                      RummagerTaxonomySidebarLinks
         | 
| 33 | 
            +
                    end
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  def collections
         | 
| 37 | 
            +
                    links = @content_item.related_collections
         | 
| 38 | 
            +
                    links.map do |link|
         | 
| 39 | 
            +
                      {
         | 
| 40 | 
            +
                        path: link["base_path"],
         | 
| 41 | 
            +
                        text: link["title"]
         | 
| 42 | 
            +
                      }
         | 
| 43 | 
            +
                    end
         | 
| 44 | 
            +
                  end
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,29 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: govuk_publishing_components
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 6.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - GOV.UK Dev
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-03- | 
| 11 | 
            +
            date: 2018-03-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: govuk_app_config
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - ">="
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '0'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ">="
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0'
         | 
| 13 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 28 | 
             
              name: rails
         | 
| 15 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -108,20 +122,6 @@ dependencies: | |
| 108 122 | 
             
                - - ">="
         | 
| 109 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 124 | 
             
                    version: '0'
         | 
| 111 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 112 | 
            -
              name: govuk_navigation_helpers
         | 
| 113 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 | 
            -
                requirements:
         | 
| 115 | 
            -
                - - "~>"
         | 
| 116 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: 9.2.1
         | 
| 118 | 
            -
              type: :runtime
         | 
| 119 | 
            -
              prerelease: false
         | 
| 120 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            -
                requirements:
         | 
| 122 | 
            -
                - - "~>"
         | 
| 123 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version: 9.2.1
         | 
| 125 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 126 | 
             
              name: govuk-lint
         | 
| 127 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -389,15 +389,22 @@ files: | |
| 389 389 | 
             
            - lib/generators/govuk_publishing_components/templates/_component.scss
         | 
| 390 390 | 
             
            - lib/generators/govuk_publishing_components/templates/component.yml.erb
         | 
| 391 391 | 
             
            - lib/govuk_publishing_components.rb
         | 
| 392 | 
            -
            - lib/govuk_publishing_components/app_helpers/ | 
| 393 | 
            -
            - lib/govuk_publishing_components/app_helpers/step_nav_helper.rb
         | 
| 392 | 
            +
            - lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb
         | 
| 394 393 | 
             
            - lib/govuk_publishing_components/config.rb
         | 
| 395 394 | 
             
            - lib/govuk_publishing_components/engine.rb
         | 
| 396 395 | 
             
            - lib/govuk_publishing_components/minitest/component_guide_test.rb
         | 
| 396 | 
            +
            - lib/govuk_publishing_components/presenters/breadcrumbs.rb
         | 
| 397 | 
            +
            - lib/govuk_publishing_components/presenters/content_item.rb
         | 
| 397 398 | 
             
            - lib/govuk_publishing_components/presenters/contextual_navigation.rb
         | 
| 399 | 
            +
            - lib/govuk_publishing_components/presenters/curated_taxonomy_sidebar_links.rb
         | 
| 398 400 | 
             
            - lib/govuk_publishing_components/presenters/navigation_type.rb
         | 
| 399 401 | 
             
            - lib/govuk_publishing_components/presenters/related_navigation_helper.rb
         | 
| 402 | 
            +
            - lib/govuk_publishing_components/presenters/rummager_taxonomy_sidebar_links.rb
         | 
| 403 | 
            +
            - lib/govuk_publishing_components/presenters/services.rb
         | 
| 400 404 | 
             
            - lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb
         | 
| 405 | 
            +
            - lib/govuk_publishing_components/presenters/step_nav_helper.rb
         | 
| 406 | 
            +
            - lib/govuk_publishing_components/presenters/taxon_breadcrumbs.rb
         | 
| 407 | 
            +
            - lib/govuk_publishing_components/presenters/taxonomy_sidebar.rb
         | 
| 401 408 | 
             
            - lib/govuk_publishing_components/version.rb
         | 
| 402 409 | 
             
            - lib/tasks/govuk_publishing_components_tasks.rake
         | 
| 403 410 | 
             
            homepage: https://github.com/alphagov/govuk_publishing_components
         | 
| @@ -1,33 +0,0 @@ | |
| 1 | 
            -
            module GovukPublishingComponents
         | 
| 2 | 
            -
              module AppHelpers
         | 
| 3 | 
            -
                class StepNav
         | 
| 4 | 
            -
                  def initialize(content_item)
         | 
| 5 | 
            -
                    @content_item = content_item.deep_symbolize_keys
         | 
| 6 | 
            -
                  end
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  def title
         | 
| 9 | 
            -
                    content_item[:title]
         | 
| 10 | 
            -
                  end
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                  def base_path
         | 
| 13 | 
            -
                    content_item[:base_path]
         | 
| 14 | 
            -
                  end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                  def content_id
         | 
| 17 | 
            -
                    content_item[:content_id]
         | 
| 18 | 
            -
                  end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                  def content
         | 
| 21 | 
            -
                    content_item.dig(:details, :step_by_step_nav)
         | 
| 22 | 
            -
                  end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                  def steps
         | 
| 25 | 
            -
                    content_item.dig(:details, :step_by_step_nav, :steps)
         | 
| 26 | 
            -
                  end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                private
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                  attr_reader :content_item
         | 
| 31 | 
            -
                end
         | 
| 32 | 
            -
              end
         | 
| 33 | 
            -
            end
         |