govuk_publishing_components 5.4.0 → 5.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d641536678da47028e081ee9005030f0005db516c354c754052222dacd2d48c
4
- data.tar.gz: d89d55dd38eacae4f679cb151c686ef1835760553c09fd3d25b4dff1c2b15a18
3
+ metadata.gz: 8d843c3f7f78559a8e8bbe5a24f026a58131f4a1558a33b878266fe89ce5239d
4
+ data.tar.gz: 4baecf33e59f1b631786a43f1af3a9c83fd9d57fef96e1c2475ec5cc5829804c
5
5
  SHA512:
6
- metadata.gz: 8db07aa8a90735a1303e997855f34e6b8cafc326bb0f663439b2b66a05622fd30386a836480c1dc04af7c2ffbb5e84b0840c65079ae1352bb20617bc94d53880
7
- data.tar.gz: 6284f25ac80fc5cc06b2fe502b314065224c0287aa944c53dd9371c7a5b247ae9b0f77a38cb906661f0aa0b417d50347de049ee5347e52fd223bc750725a03cd
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").map(&:parent).map(&:content_id).include?(grandparent["content_id"])
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
- @content ||= content_item.dig(:details, :step_by_step_nav)
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
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '5.4.0'.freeze
2
+ VERSION = '5.4.1'.freeze
3
3
  end
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.0
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-07 00:00:00.000000000 Z
11
+ date: 2018-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails