Class: GovukNavigationHelpers::RelatedItems
- Inherits:
-
Object
- Object
- GovukNavigationHelpers::RelatedItems
- Defined in:
- lib/govuk_navigation_helpers/related_items.rb
Overview
Generate data for the “Related Items” component
govuk-component-guide.herokuapp.com/components/related_items
The procedure to group the links is quite complicated. In short, related links are grouped by how related they are to the current page.
The wiki page on related items has more information:
gov-uk.atlassian.net/wiki/pages/viewpage.action?pageId=99876878
Instance Method Summary collapse
-
#initialize(content_item) ⇒ RelatedItems
constructor
A new instance of RelatedItems.
- #related_items ⇒ Object
Constructor Details
#initialize(content_item) ⇒ RelatedItems
Returns a new instance of RelatedItems.
16 17 18 |
# File 'lib/govuk_navigation_helpers/related_items.rb', line 16 def initialize(content_item) @content_item = ContentItem.new(content_item) end |
Instance Method Details
#related_items ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/govuk_navigation_helpers/related_items.rb', line 20 def { sections: [ tagged_to_same_mainstream_browse_page_section, parents_tagged_to_same_mainstream_browse_page_section, tagged_to_different_mainstream_browse_pages_section, , ].compact } end |