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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/govuk_navigation_helpers.rb +3 -3
- data/lib/govuk_navigation_helpers/content_item.rb +4 -0
- data/lib/govuk_navigation_helpers/related_navigation_sidebar.rb +11 -0
- data/lib/govuk_navigation_helpers/version.rb +1 -1
- data/spec/navigation_sidebar_spec.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2c4644606497db5d6ae79f9f8a67b856e8d3f87
|
4
|
+
data.tar.gz: 1e5487023976443194ceb13ad150448298a1e5a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c594e80668e35db4d3182528653309090007e4cee7c1c98cf2a9fbcfe1a4aa72ef8702a97c8d5a5db209b61a72bb444d1f1e98297f80ef15a62e711f342d0a7
|
7
|
+
data.tar.gz: 2129c71dcb21c224effd2be1ffabaa1728ce3f9a0635cbfa3bcf38a077f17a87981dbf727a6d2ee99162f7ea1a651caee75761df565f745e753b8c3dff8e33bb
|
data/CHANGELOG.md
CHANGED
@@ -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
|
50
|
+
# the related navigation component
|
51
51
|
#
|
52
|
-
# @return [Hash] Payload for the GOV.UK related navigation
|
53
|
-
# @see https://government-frontend.herokuapp.com/component-guide/related-navigation
|
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
|
@@ -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.
|
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
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|