govuk_navigation_helpers 2.4.1 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96733a7614897c0c7289e94d1b07b01854704614
4
- data.tar.gz: 7f5b667aa01be69cc1d9324ebabb6db151090c71
3
+ metadata.gz: f0da568d8966938138a71bd542f1c3dbd4bd5435
4
+ data.tar.gz: dede7b2b009fbee5525533674a15331885632529
5
5
  SHA512:
6
- metadata.gz: e74bf5f3785e7017722fc3e540626de37c983e2124589a9d595539f3b50bf78f18a80ee17a20c6c52411db26049d1d40fd02b343f5be6530d3708a9c655358a7
7
- data.tar.gz: 9e55565a8216e3bd4a9f95c52e15aeda80e1ed2d73d82dc1d3e566937c3aa393f02958d574532dd5f7ddfc1412186784c724f668664471e0ca73a77ad984e027
6
+ metadata.gz: e2224955a506f0d2d66ba807c4321ed8a866b2160a5cc769785dde0b95fe57efe1168fe5b96d43fa8285d94d0f48d28f51ec2729f5b970da1722a933dc08823a
7
+ data.tar.gz: 959ea2dc26fb29cdf9cd99c509091af5abeb776d0a0cbe27d2b7798e629b74a8bd26d1f081eb8fa6750564bf78b8f1cb71632d71a0c8eb3d687347570af10b5f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## 3.0.0
2
+
3
+ * **BREAKING CHANGE**: remove unnecessary nesting from taxonomy sidebar helper.
4
+ The schema has changed from:
5
+
6
+ ```json
7
+ {
8
+ "sections": [
9
+ {
10
+ "title": "String",
11
+ "items": []
12
+ }
13
+ ]
14
+ }
15
+ ```
16
+
17
+ to:
18
+
19
+ ```json
20
+ {
21
+ "items": []
22
+ }
23
+ ```
24
+
25
+ * The taxonomy sidebar helper returns an object whose keys are all symbols, as
26
+ required by Govuk Components
27
+
1
28
  ## 2.4.1
2
29
 
3
30
  * Add related content to the taxonomy sidebar helper
@@ -10,7 +10,7 @@ module GovukNavigationHelpers
10
10
 
11
11
  def sidebar
12
12
  {
13
- sections: taxons.any? ? [{ title: "More about #{@content_item.title}", items: taxons }] : []
13
+ items: taxons
14
14
  }
15
15
  end
16
16
 
@@ -33,7 +33,7 @@ module GovukNavigationHelpers
33
33
  # the content store
34
34
  def content_related_to(taxon)
35
35
  begin
36
- Services.rummager.search(
36
+ results = Services.rummager.search(
37
37
  similar_to: @content_item.base_path,
38
38
  start: 0,
39
39
  count: 5,
@@ -41,6 +41,13 @@ module GovukNavigationHelpers
41
41
  filter_content_store_document_type: Guidance::DOCUMENT_TYPES,
42
42
  fields: %w[title link],
43
43
  )['results']
44
+
45
+ results.map do |result|
46
+ {
47
+ title: result['title'],
48
+ link: result['link'],
49
+ }
50
+ end
44
51
  rescue StandardError => e
45
52
  GovukNavigationHelpers.configuration.error_handler.notify(e)
46
53
  []
@@ -1,3 +1,3 @@
1
1
  module GovukNavigationHelpers
2
- VERSION = "2.4.1".freeze
2
+ VERSION = "3.0.0".freeze
3
3
  end
@@ -34,7 +34,7 @@ RSpec.describe GovukNavigationHelpers::TaxonomySidebar do
34
34
  content_item = { "links" => {} }
35
35
 
36
36
  expect(sidebar_for(content_item)).to eq(
37
- sections: []
37
+ items: []
38
38
  )
39
39
  end
40
40
  end
@@ -44,34 +44,29 @@ RSpec.describe GovukNavigationHelpers::TaxonomySidebar do
44
44
  content_item = content_item_tagged_to_taxon
45
45
 
46
46
  expect(sidebar_for(content_item)).to eq(
47
- sections: [
47
+ items: [
48
48
  {
49
- title: "More about A piece of content",
50
- items: [
49
+ title: "Taxon 1",
50
+ url: "/taxon-1",
51
+ description: "The 1st taxon.",
52
+ related_content: [
51
53
  {
52
- title: "Taxon 1",
53
- url: "/taxon-1",
54
- description: "The 1st taxon.",
55
- related_content: [
56
- {
57
- "title" => 'Result Content',
58
- "link" => '/result-content',
59
- },
60
- ],
54
+ title: 'Result Content',
55
+ link: '/result-content',
61
56
  },
57
+ ],
58
+ },
59
+ {
60
+ title: "Taxon 2",
61
+ url: "/taxon-2",
62
+ description: "The 2nd taxon.",
63
+ related_content: [
62
64
  {
63
- title: "Taxon 2",
64
- url: "/taxon-2",
65
- description: "The 2nd taxon.",
66
- related_content: [
67
- {
68
- "title" => 'Result Content',
69
- "link" => '/result-content',
70
- },
71
- ],
65
+ title: 'Result Content',
66
+ link: '/result-content',
72
67
  },
73
68
  ],
74
- }
69
+ },
75
70
  ]
76
71
  )
77
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_navigation_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev