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 +4 -4
- data/CHANGELOG.md +27 -0
- data/lib/govuk_navigation_helpers/taxonomy_sidebar.rb +9 -2
- data/lib/govuk_navigation_helpers/version.rb +1 -1
- data/spec/taxonomy_sidebar_spec.rb +18 -23
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0da568d8966938138a71bd542f1c3dbd4bd5435
|
4
|
+
data.tar.gz: dede7b2b009fbee5525533674a15331885632529
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
[]
|
@@ -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
|
-
|
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
|
-
|
47
|
+
items: [
|
48
48
|
{
|
49
|
-
title: "
|
50
|
-
|
49
|
+
title: "Taxon 1",
|
50
|
+
url: "/taxon-1",
|
51
|
+
description: "The 1st taxon.",
|
52
|
+
related_content: [
|
51
53
|
{
|
52
|
-
title:
|
53
|
-
|
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:
|
64
|
-
|
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
|