govuk_publishing_components 5.4.0 → 5.4.1
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d843c3f7f78559a8e8bbe5a24f026a58131f4a1558a33b878266fe89ce5239d
|
|
4
|
+
data.tar.gz: 4baecf33e59f1b631786a43f1af3a9c83fd9d57fef96e1c2475ec5cc5829804c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 31dc8a84299695fe5d4c3f1cf6f9108f59b975060d628206a60fc8136d8073210df59a77c099afd51d3085162cbd195fccee50e90b371e9497e03f56d3142e9c
|
|
7
|
+
data.tar.gz: 4a58f9da9f33d430fadc0cd0fa0cc1245d7788ab363525985d8d689313cd0032cbd118623c973ef5a29b367e88e83f10d6e1ea566890a21d6fa7f27407a5308a
|
|
@@ -24,7 +24,6 @@ class RelatedNavigationHelper
|
|
|
24
24
|
{ "topical_events" => related_topical_events },
|
|
25
25
|
{ "world_locations" => related_world_locations },
|
|
26
26
|
{ "statistical_data_sets" => related_statistical_data_sets },
|
|
27
|
-
{ "worldwide_organisations" => related_worldwide_organisations },
|
|
28
27
|
]
|
|
29
28
|
|
|
30
29
|
other = [related_external_links, related_contacts] || []
|
|
@@ -100,11 +99,6 @@ private
|
|
|
100
99
|
build_links_for_sidebar(locations)
|
|
101
100
|
end
|
|
102
101
|
|
|
103
|
-
def related_worldwide_organisations
|
|
104
|
-
organisations = filter_link_type("worldwide_organisations", "worldwide_organisation")
|
|
105
|
-
build_links_for_sidebar(organisations)
|
|
106
|
-
end
|
|
107
|
-
|
|
108
102
|
def related_collections
|
|
109
103
|
collections = filter_link_type("document_collections", "document_collection")
|
|
110
104
|
build_links_for_sidebar(collections)
|
|
@@ -172,7 +166,7 @@ private
|
|
|
172
166
|
end
|
|
173
167
|
|
|
174
168
|
def grandparent
|
|
175
|
-
parent.dig("parent", 0)
|
|
169
|
+
parent.dig("links", "parent", 0)
|
|
176
170
|
end
|
|
177
171
|
|
|
178
172
|
# This method post-processes the topics collated by the helper.
|
|
@@ -214,12 +208,14 @@ private
|
|
|
214
208
|
|
|
215
209
|
def parents_tagged_to_same_mainstream_browse_page
|
|
216
210
|
return [] unless parent && grandparent
|
|
217
|
-
|
|
218
|
-
common_parent_content_ids = tagged_to_same_mainstream_browse_page.map(&:content_id)
|
|
211
|
+
common_parent_content_ids = tagged_to_same_mainstream_browse_page.map { |item| item["content_id"] }
|
|
219
212
|
|
|
220
213
|
@parents_tagged_to_same_mainstream_browse_page ||= related_links.select do |related_item|
|
|
221
214
|
next if common_parent_content_ids.include?(related_item["content_id"])
|
|
222
|
-
related_item.dig("links", "mainstream_browse_pages")
|
|
215
|
+
mainstream_browse_pages = related_item.dig("links", "mainstream_browse_pages")
|
|
216
|
+
parents = mainstream_browse_pages.map { |page| page["links"]["parent"][0] }
|
|
217
|
+
content_ids = parents.map { |parent| parent["content_id"] }
|
|
218
|
+
content_ids.include?(grandparent["content_id"])
|
|
223
219
|
end
|
|
224
220
|
end
|
|
225
221
|
|
|
@@ -13,7 +13,11 @@ module GovukPublishingComponents
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def content
|
|
16
|
-
|
|
16
|
+
content_item.dig(:details, :step_by_step_nav)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def steps
|
|
20
|
+
content_item.dig(:details, :step_by_step_nav, :steps)
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
private
|
|
@@ -12,9 +12,12 @@ module GovukPublishingComponents
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def show_sidebar?
|
|
15
|
+
show_header? && first_step_nav.steps.present?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def show_header?
|
|
15
19
|
step_navs.count == 1
|
|
16
20
|
end
|
|
17
|
-
alias_method :show_header?, :show_sidebar?
|
|
18
21
|
|
|
19
22
|
def show_related_links?
|
|
20
23
|
step_navs.any? && step_navs.count < 5
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_publishing_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.4.
|
|
4
|
+
version: 5.4.1
|
|
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: 2018-03-
|
|
11
|
+
date: 2018-03-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|