govuk_navigation_helpers 7.1.0 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3017d40e8156702b7e7af8aa4872cf2e34257772
4
- data.tar.gz: 1ecf2847c2c9b062423c3edd50ab2eec59483d8e
3
+ metadata.gz: a2c4644606497db5d6ae79f9f8a67b856e8d3f87
4
+ data.tar.gz: 1e5487023976443194ceb13ad150448298a1e5a1
5
5
  SHA512:
6
- metadata.gz: faad2926bd20b3c53af19202469eecc0af10088292226e2bfb9dffc9b9620fe1fb0b36f6c9fcfcef93e6b9aa3c0f3885de823e8cc3abb3e9afcc09782275497f
7
- data.tar.gz: cdf11771a20dc7711c69414bd4a88cf3a8a736ffa16fcbb3c3e6196fd13fde836591569c3432e281570f747f570a90c31d2aace8fe648f4389ebbf3fedf50a90
6
+ metadata.gz: 3c594e80668e35db4d3182528653309090007e4cee7c1c98cf2a9fbcfe1a4aa72ef8702a97c8d5a5db209b61a72bb444d1f1e98297f80ef15a62e711f342d0a7
7
+ data.tar.gz: 2129c71dcb21c224effd2be1ffabaa1728ce3f9a0635cbfa3bcf38a077f17a87981dbf727a6d2ee99162f7ea1a651caee75761df565f745e753b8c3dff8e33bb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 7.2.0
2
+
3
+ * Update related navigation sidebar helper to also return world location data
4
+
1
5
  ## 7.1.0
2
6
 
3
7
  * Add helper for rendering related navigation sidebar on content pages with universal layout
@@ -47,10 +47,10 @@ module GovukNavigationHelpers
47
47
  end
48
48
 
49
49
  # Generate a payload containing related navigation sidebar data. Intended for use with
50
- # the related navigation sidebar component
50
+ # the related navigation component
51
51
  #
52
- # @return [Hash] Payload for the GOV.UK related navigation sidebar component
53
- # @see https://government-frontend.herokuapp.com/component-guide/related-navigation-sidebar
52
+ # @return [Hash] Payload for the GOV.UK related navigation component
53
+ # @see https://government-frontend.herokuapp.com/component-guide/related-navigation
54
54
  def related_navigation_sidebar
55
55
  RelatedNavigationSidebar.new(content_item).related_navigation_sidebar
56
56
  end
@@ -105,6 +105,10 @@ module GovukNavigationHelpers
105
105
  filter_link_type(content_store_response.dig("links", "topics").to_a, "topic")
106
106
  end
107
107
 
108
+ def related_world_locations
109
+ content_store_response.dig("links", "world_locations").to_a
110
+ end
111
+
108
112
  def external_links
109
113
  content_store_response.dig("details", "external_related_links").to_a
110
114
  end
@@ -14,6 +14,7 @@ module GovukNavigationHelpers
14
14
  topics: related_topics,
15
15
  policies: related_policies,
16
16
  publishers: related_organisations,
17
+ world_locations: related_world_locations,
17
18
  other: [related_external_links, related_contacts]
18
19
  }
19
20
  end
@@ -29,6 +30,10 @@ module GovukNavigationHelpers
29
30
  end
30
31
  end
31
32
 
33
+ def world_location_base_path(title)
34
+ "/world/#{title.downcase.tr(' ', '-')}/news"
35
+ end
36
+
32
37
  def related_items
33
38
  quick_links = build_links_for_sidebar(@content_item.quick_links, "url")
34
39
 
@@ -39,6 +44,12 @@ module GovukNavigationHelpers
39
44
  build_links_for_sidebar(@content_item.related_organisations)
40
45
  end
41
46
 
47
+ def related_world_locations
48
+ locations = @content_item.related_world_locations
49
+ locations.map! { |link| link.merge("base_path" => world_location_base_path(link["title"])) }
50
+ build_links_for_sidebar(locations)
51
+ end
52
+
42
53
  def related_collections
43
54
  build_links_for_sidebar(@content_item.related_collections)
44
55
  end
@@ -1,3 +1,3 @@
1
1
  module GovukNavigationHelpers
2
- VERSION = "7.1.0".freeze
2
+ VERSION = "7.2.0".freeze
3
3
  end
@@ -29,6 +29,7 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
29
29
  topics: [],
30
30
  policies: [],
31
31
  publishers: [],
32
+ world_locations: [],
32
33
  other: [[], []]
33
34
  }
34
35
 
@@ -91,7 +92,14 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
91
92
  "title" => "related policy",
92
93
  "document_type" => "policy"
93
94
  }
94
- ]
95
+ ],
96
+ "world_locations" => [
97
+ {
98
+ "content_id" => "32c1b93d-2553-47c9-bc3c-fc5b513ecc32",
99
+ "title" => "World Location",
100
+ "locale" => "en"
101
+ }
102
+ ],
95
103
  }
96
104
  )
97
105
 
@@ -101,6 +109,7 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
101
109
  topics: [{ path: "/related-topic", text: "related topic" }],
102
110
  policies: [{ path: "/related-policy", text: "related policy" }],
103
111
  publishers: [{ path: "/related-organisation", text: "related organisation" }],
112
+ world_locations: [{ path: "/world/world-location/news", text: "World Location" }],
104
113
  other: [[], []]
105
114
  }
106
115
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_navigation_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0
4
+ version: 7.2.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: 2017-11-30 00:00:00.000000000 Z
11
+ date: 2017-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters