Class: GovukNavigationHelpers::NavigationHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/govuk_navigation_helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(content_item) ⇒ NavigationHelper

Returns a new instance of NavigationHelper.



17
18
19
# File 'lib/govuk_navigation_helpers.rb', line 17

def initialize(content_item)
  @content_item = content_item
end

Instance Method Details

Generate a breadcrumb trail

Returns:

  • (Hash)

    Payload for the GOV.UK breadcrumbs component

See Also:



25
26
27
# File 'lib/govuk_navigation_helpers.rb', line 25

def breadcrumbs
  Breadcrumbs.new(content_item).breadcrumbs
end

Generate a related items payload

Returns:

  • (Hash)

    Payload for the GOV.UK Component

See Also:



50
51
52
# File 'lib/govuk_navigation_helpers.rb', line 50

def related_items
  RelatedItems.new(content_item).related_items
end

#taxon_breadcrumbsHash

Generate a breadcrumb trail for a taxon, using the taxon_parent link field

Returns:

  • (Hash)

    Payload for the GOV.UK breadcrumbs component

See Also:



33
34
35
# File 'lib/govuk_navigation_helpers.rb', line 33

def taxon_breadcrumbs
  TaxonBreadcrumbs.new(content_item).breadcrumbs
end

#taxonomy_sidebarHash

Generate a payload containing taxon sidebar data. Intended for use with the related items component.

Returns:

  • (Hash)

    Payload for the GOV.UK related items component

See Also:



42
43
44
# File 'lib/govuk_navigation_helpers.rb', line 42

def taxonomy_sidebar
  TaxonomySidebar.new(content_item).sidebar
end