govuk_publishing_components 9.27.0 → 9.28.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd97893a0b544cc658d03a410175d5f5bef9173a23368563ad0b1bfc3a3f1e98
|
4
|
+
data.tar.gz: 380f25942322cee9c5efb96fa977faf46ae5597dddf5012333f99a294946df6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c7bf5aa73ddb895bd8cf6457d5f0f0d18f3ea7aa06f52a9e4d5a2aa51dd3472f8340fd4ebc263976d2d02aae75579d33968288970a167756f8401d1ba7a50b
|
7
|
+
data.tar.gz: 32476ad88ae096153c99d1fd6ecb9036d1c69e9bd24b6c888986aa0ff32183d4944ee9ac348ec8400946cb97ccfbcafb1b3e381386f2ce5a227a273658fdb932
|
@@ -15,6 +15,12 @@ module GovukPublishingComponents
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
def related_to_step_navs
|
19
|
+
@related_to_step_navs ||= parsed_related_to_step_navs.map do |step_nav|
|
20
|
+
StepByStepModel.new(step_nav)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
18
24
|
def show_sidebar?
|
19
25
|
show_header? && current_step_nav.steps.present?
|
20
26
|
end
|
@@ -24,11 +30,12 @@ module GovukPublishingComponents
|
|
24
30
|
end
|
25
31
|
|
26
32
|
def show_related_links?
|
27
|
-
|
33
|
+
return true if active_step_by_step?
|
34
|
+
step_navs.any? && step_navs.count < 5
|
28
35
|
end
|
29
36
|
|
30
37
|
def show_also_part_of_step_nav?
|
31
|
-
active_step_by_step? && also_part_of_step_nav.any?
|
38
|
+
active_step_by_step? && also_part_of_step_nav.any? && step_navs_combined_list.count < 5
|
32
39
|
end
|
33
40
|
|
34
41
|
def related_links
|
@@ -37,7 +44,8 @@ module GovukPublishingComponents
|
|
37
44
|
end
|
38
45
|
|
39
46
|
def also_part_of_step_nav
|
40
|
-
|
47
|
+
step_navs_list = step_navs_combined_list
|
48
|
+
step_by_step_navs = step_navs_list.delete_if { |step_nav| step_nav.content_id == active_step_by_step.content_id }
|
41
49
|
format_related_links(step_by_step_navs)
|
42
50
|
end
|
43
51
|
|
@@ -67,7 +75,8 @@ module GovukPublishingComponents
|
|
67
75
|
end
|
68
76
|
|
69
77
|
def active_step_by_step
|
70
|
-
|
78
|
+
step_navs_list = step_navs_combined_list
|
79
|
+
@active_step_navs ||= step_navs_list.select { |step_nav| step_nav.content_id == active_step_nav_content_id }
|
71
80
|
@active_step_navs.first
|
72
81
|
end
|
73
82
|
|
@@ -88,10 +97,21 @@ module GovukPublishingComponents
|
|
88
97
|
@steps ||= step_nav[:steps]
|
89
98
|
end
|
90
99
|
|
100
|
+
def step_navs_combined_list
|
101
|
+
step_nav_list = []
|
102
|
+
step_nav_list += step_navs if step_navs.any?
|
103
|
+
step_nav_list += related_to_step_navs if related_to_step_navs.any?
|
104
|
+
step_nav_list
|
105
|
+
end
|
106
|
+
|
91
107
|
def parsed_step_navs
|
92
108
|
content_item.dig("links", "part_of_step_navs").to_a
|
93
109
|
end
|
94
110
|
|
111
|
+
def parsed_related_to_step_navs
|
112
|
+
content_item.dig("links", "related_to_step_navs").to_a
|
113
|
+
end
|
114
|
+
|
95
115
|
def configure_for_sidebar(step_nav_content)
|
96
116
|
step_nav_content[:steps].each_with_index do |step, step_index|
|
97
117
|
step[:contents].each do |content|
|