govuk_navigation_helpers 7.2.0 → 7.3.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/content_item.rb +8 -0
- data/lib/govuk_navigation_helpers/related_navigation_sidebar.rb +10 -0
- data/lib/govuk_navigation_helpers/version.rb +1 -1
- data/spec/{navigation_sidebar_spec.rb → related_navigation_sidebar_spec.rb} +51 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd5ef3d4af8ffb2176daca33c354ac2d962bae58
|
4
|
+
data.tar.gz: 4a1d6327ee72a8f91795c76a473df9320bb05f0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed4664e5fd7885e675555108d62003a499a7e1e9da22ce6703dde2e27720c83b7f1b458204b8395b05124f4a083663cfbe7e1deebff2237bd3d81b8f78202eef
|
7
|
+
data.tar.gz: e09067d9582334c4550a398b9deffed871675cac61e5206910d1c7c929711e2e9cfd59a005d5061557dc9bc8c25b0d5834859e5f39154ba948cec65cc2130ae6
|
data/CHANGELOG.md
CHANGED
@@ -105,10 +105,18 @@ module GovukNavigationHelpers
|
|
105
105
|
filter_link_type(content_store_response.dig("links", "topics").to_a, "topic")
|
106
106
|
end
|
107
107
|
|
108
|
+
def related_topical_events
|
109
|
+
filter_link_type(content_store_response.dig("links", "topical_events").to_a, "topical_event")
|
110
|
+
end
|
111
|
+
|
108
112
|
def related_world_locations
|
109
113
|
content_store_response.dig("links", "world_locations").to_a
|
110
114
|
end
|
111
115
|
|
116
|
+
def related_worldwide_organisations
|
117
|
+
filter_link_type(content_store_response.dig("links", "worldwide_organisations").to_a, "worldwide_organisation")
|
118
|
+
end
|
119
|
+
|
112
120
|
def external_links
|
113
121
|
content_store_response.dig("details", "external_related_links").to_a
|
114
122
|
end
|
@@ -12,9 +12,11 @@ module GovukNavigationHelpers
|
|
12
12
|
related_items: related_items,
|
13
13
|
collections: related_collections,
|
14
14
|
topics: related_topics,
|
15
|
+
topical_events: related_topical_events,
|
15
16
|
policies: related_policies,
|
16
17
|
publishers: related_organisations,
|
17
18
|
world_locations: related_world_locations,
|
19
|
+
worldwide_organisations: related_worldwide_organisations,
|
18
20
|
other: [related_external_links, related_contacts]
|
19
21
|
}
|
20
22
|
end
|
@@ -50,6 +52,10 @@ module GovukNavigationHelpers
|
|
50
52
|
build_links_for_sidebar(locations)
|
51
53
|
end
|
52
54
|
|
55
|
+
def related_worldwide_organisations
|
56
|
+
build_links_for_sidebar(@content_item.related_worldwide_organisations)
|
57
|
+
end
|
58
|
+
|
53
59
|
def related_collections
|
54
60
|
build_links_for_sidebar(@content_item.related_collections)
|
55
61
|
end
|
@@ -62,6 +68,10 @@ module GovukNavigationHelpers
|
|
62
68
|
build_links_for_sidebar(@content_item.related_topics)
|
63
69
|
end
|
64
70
|
|
71
|
+
def related_topical_events
|
72
|
+
build_links_for_sidebar(@content_item.related_topical_events)
|
73
|
+
end
|
74
|
+
|
65
75
|
def related_contacts
|
66
76
|
return [] unless @content_item.related_other_contacts.any?
|
67
77
|
[
|
@@ -27,9 +27,11 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
|
|
27
27
|
related_items: [],
|
28
28
|
collections: [],
|
29
29
|
topics: [],
|
30
|
+
topical_events: [],
|
30
31
|
policies: [],
|
31
32
|
publishers: [],
|
32
33
|
world_locations: [],
|
34
|
+
worldwide_organisations: [],
|
33
35
|
other: [[], []]
|
34
36
|
}
|
35
37
|
|
@@ -75,6 +77,15 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
|
|
75
77
|
"document_type" => "topic"
|
76
78
|
}
|
77
79
|
],
|
80
|
+
"topical_events" => [
|
81
|
+
{
|
82
|
+
"content_id" => "32c1b93d-2553-47c9-bc3c-fc5b513ecc32",
|
83
|
+
"locale" => "en",
|
84
|
+
"base_path" => "/related-topical-event",
|
85
|
+
"title" => "related topical event",
|
86
|
+
"document_type" => "topical_event"
|
87
|
+
}
|
88
|
+
],
|
78
89
|
"organisations" => [
|
79
90
|
{
|
80
91
|
"content_id" => "32c1b93d-2553-47c9-bc3c-fc5b513ecc32",
|
@@ -107,15 +118,55 @@ RSpec.describe GovukNavigationHelpers::RelatedNavigationSidebar do
|
|
107
118
|
related_items: [{ path: "/related-item", text: "related item" }],
|
108
119
|
collections: [{ path: "/related-collection", text: "related collection" }],
|
109
120
|
topics: [{ path: "/related-topic", text: "related topic" }],
|
121
|
+
topical_events: [{ path: "/related-topical-event", text: "related topical event" }],
|
110
122
|
policies: [{ path: "/related-policy", text: "related policy" }],
|
111
123
|
publishers: [{ path: "/related-organisation", text: "related organisation" }],
|
112
124
|
world_locations: [{ path: "/world/world-location/news", text: "World Location" }],
|
125
|
+
worldwide_organisations: [],
|
113
126
|
other: [[], []]
|
114
127
|
}
|
115
128
|
|
116
129
|
expect(payload).to eql(expected)
|
117
130
|
end
|
118
131
|
|
132
|
+
it "returns worldwide organisations" do
|
133
|
+
payload = payload_for("world_location_news_article",
|
134
|
+
"details" => {
|
135
|
+
"body" => "body",
|
136
|
+
"government" => {
|
137
|
+
"title" => "government",
|
138
|
+
"slug" => "government",
|
139
|
+
"current" => true
|
140
|
+
},
|
141
|
+
"political" => true,
|
142
|
+
"first_public_at" => "2016-01-01T19:00:00Z",
|
143
|
+
},
|
144
|
+
"links" => {
|
145
|
+
"worldwide_organisations" => [
|
146
|
+
{
|
147
|
+
"content_id" => "32c1b93d-2553-47c9-bc3c-fc5b513ecc32",
|
148
|
+
"title" => "related worldwide organisation",
|
149
|
+
"base_path" => "/related-worldwide-organisation",
|
150
|
+
"document_type" => "worldwide_organisation",
|
151
|
+
"locale" => "en"
|
152
|
+
}
|
153
|
+
],
|
154
|
+
}
|
155
|
+
)
|
156
|
+
expected = {
|
157
|
+
related_items: [],
|
158
|
+
collections: [],
|
159
|
+
topics: [],
|
160
|
+
topical_events: [],
|
161
|
+
policies: [],
|
162
|
+
publishers: [],
|
163
|
+
world_locations: [],
|
164
|
+
worldwide_organisations: [{ path: "/related-worldwide-organisation", text: "related worldwide organisation" }],
|
165
|
+
other: [[], []]
|
166
|
+
}
|
167
|
+
expect(payload).to eql(expected)
|
168
|
+
end
|
169
|
+
|
119
170
|
it "returns an Elsewhere on the web section for external related links" do
|
120
171
|
payload = payload_for("placeholder",
|
121
172
|
"details" => {
|
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.3.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-12-
|
11
|
+
date: 2017-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gds-api-adapters
|
@@ -184,8 +184,8 @@ files:
|
|
184
184
|
- lib/govuk_navigation_helpers/version.rb
|
185
185
|
- spec/breadcrumbs_spec.rb
|
186
186
|
- spec/content_item_spec.rb
|
187
|
-
- spec/navigation_sidebar_spec.rb
|
188
187
|
- spec/related_items_spec.rb
|
188
|
+
- spec/related_navigation_sidebar_spec.rb
|
189
189
|
- spec/spec_helper.rb
|
190
190
|
- spec/taxon_breadcrumbs_spec.rb
|
191
191
|
- spec/taxonomy_sidebar_spec.rb
|
@@ -216,8 +216,8 @@ summary: Gem to transform items from the content-store into payloads for GOV.UK
|
|
216
216
|
test_files:
|
217
217
|
- spec/breadcrumbs_spec.rb
|
218
218
|
- spec/content_item_spec.rb
|
219
|
-
- spec/navigation_sidebar_spec.rb
|
220
219
|
- spec/related_items_spec.rb
|
220
|
+
- spec/related_navigation_sidebar_spec.rb
|
221
221
|
- spec/spec_helper.rb
|
222
222
|
- spec/taxon_breadcrumbs_spec.rb
|
223
223
|
- spec/taxonomy_sidebar_spec.rb
|