govuk_publishing_components 21.63.3 → 21.64.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: 19018ea589b383f250f5b7298d06301f5b55e196b475b092e80f707f09bd399b
|
4
|
+
data.tar.gz: 1748c5cd55d806fe8e5ef22025ad348a5fe720a045d7879644980224693f8986
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 209e7cf684d04b5be7ad3c45ad8a0083c2da82c170877fca927b51b5c422e89f82de285b9c2131f5db65996aac0a28af4a7c680d34ffb827ba382b0682314d10
|
7
|
+
data.tar.gz: 17df0e8345e4fb29baaf8c3c61eeb63c68acaebdcc30a3f4cdc07e857b18f1b45368d1178717008b5027c9de1c2fffb2d4c9d84ee20c4db976376937939e4aec
|
@@ -12,18 +12,22 @@ module GovukPublishingComponents
|
|
12
12
|
}.freeze
|
13
13
|
|
14
14
|
# Returns the highest priority taxon that has a content_id matching those in PRIORITY_TAXONS
|
15
|
-
def self.call(content_item)
|
16
|
-
new(content_item).breadcrumbs
|
15
|
+
def self.call(content_item, query_parameters = nil)
|
16
|
+
new(content_item, query_parameters).breadcrumbs
|
17
17
|
end
|
18
18
|
|
19
|
-
attr_reader :content_item
|
19
|
+
attr_reader :content_item, :query_parameters
|
20
20
|
|
21
|
-
def initialize(content_item)
|
21
|
+
def initialize(content_item, query_parameters = nil)
|
22
22
|
@content_item = content_item
|
23
|
+
@query_parameters = query_parameters
|
23
24
|
end
|
24
25
|
|
25
26
|
def taxon
|
26
|
-
@taxon ||=
|
27
|
+
@taxon ||= begin
|
28
|
+
default_taxon = priority_taxons.min_by { |t| PRIORITY_TAXONS.values.index(t["content_id"]) }
|
29
|
+
preferred_taxon || default_taxon
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
def breadcrumbs
|
@@ -39,6 +43,12 @@ module GovukPublishingComponents
|
|
39
43
|
|
40
44
|
private
|
41
45
|
|
46
|
+
def preferred_taxon
|
47
|
+
if preferred_priority_taxon
|
48
|
+
priority_taxons.find { |t| t["content_id"] == preferred_priority_taxon }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
42
52
|
def priority_taxons
|
43
53
|
return [] unless content_item["links"].is_a?(Hash)
|
44
54
|
|
@@ -57,6 +67,10 @@ module GovukPublishingComponents
|
|
57
67
|
def priority_taxon?(taxon)
|
58
68
|
PRIORITY_TAXONS.values.include?(taxon["content_id"])
|
59
69
|
end
|
70
|
+
|
71
|
+
def preferred_priority_taxon
|
72
|
+
query_parameters["priority-taxon"] if query_parameters
|
73
|
+
end
|
60
74
|
end
|
61
75
|
end
|
62
76
|
end
|
@@ -30,7 +30,7 @@ module GovukPublishingComponents
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def priority_breadcrumbs
|
33
|
-
@priority_breadcrumbs ||= ContentBreadcrumbsBasedOnPriority.call(content_item)
|
33
|
+
@priority_breadcrumbs ||= ContentBreadcrumbsBasedOnPriority.call(content_item, query_parameters)
|
34
34
|
end
|
35
35
|
|
36
36
|
def topic_breadcrumbs
|
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: 21.
|
4
|
+
version: 21.64.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: 2020-09-
|
11
|
+
date: 2020-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|