metadata_presenter 3.3.20 → 3.3.22
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 +4 -4
- data/app/controllers/metadata_presenter/answers_controller.rb +1 -0
- data/app/controllers/metadata_presenter/engine_controller.rb +8 -0
- data/app/controllers/metadata_presenter/pages_controller.rb +1 -5
- data/app/models/metadata_presenter/evaluate_content_conditionals.rb +12 -18
- data/lib/metadata_presenter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04f348f4f53e3272bc416e845f9970aa6851ac22b7d069fbd52f9309f63e820c
|
4
|
+
data.tar.gz: a20ab803b0750532425e02d698adaf87c4b89f96aae65542777b46c3d240bb9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 802a3624e3953dc7bd7d2596fcc7d462e3e9ee950186e58b90c1d408fcc3a9ca308ba42b5bdded8172d4895462a67ceb0b83a674b85b5115a1316a98bd8c2a8c
|
7
|
+
data.tar.gz: 07b914afe2a8a241add444452f19e5dec3bc46da8792c1d38f840d5e7084d1a8230d2c823066677f0608b44ffbe4610efd67e9548a20a9f93913b56cce946997
|
@@ -112,6 +112,14 @@ module MetadataPresenter
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
def load_page_content
|
116
|
+
if single_page_preview?
|
117
|
+
@page.load_all_content
|
118
|
+
else
|
119
|
+
@page.load_conditional_content(service, @user_data)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
115
123
|
def maintenance_mode?
|
116
124
|
ENV['MAINTENANCE_MODE'].present? && ENV['MAINTENANCE_MODE'] == '1'
|
117
125
|
end
|
@@ -8,11 +8,7 @@ module MetadataPresenter
|
|
8
8
|
@page ||= service.find_page_by_url(request.env['PATH_INFO'])
|
9
9
|
if @page
|
10
10
|
load_autocomplete_items
|
11
|
-
|
12
|
-
@page.load_all_content
|
13
|
-
else
|
14
|
-
@page.load_conditional_content(service, @user_data)
|
15
|
-
end
|
11
|
+
load_page_content
|
16
12
|
|
17
13
|
@page_answers = PageAnswers.new(@page, @user_data)
|
18
14
|
render template: @page.template
|
@@ -22,26 +22,20 @@ module MetadataPresenter
|
|
22
22
|
|
23
23
|
def uuid_to_include?(candidate_component)
|
24
24
|
evaluation_conditions = []
|
25
|
-
|
26
|
-
|
25
|
+
|
26
|
+
if candidate_component.conditionals.count > 1
|
27
|
+
candidate_component.conditionals.each do |conditional|
|
28
|
+
evaluation_conditions << if conditional[:_type] == 'and'
|
29
|
+
evaluate_condition(conditional).flatten.all?
|
30
|
+
else
|
31
|
+
evaluate_condition(conditional)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
candidate_component.uuid if evaluation_conditions.flatten.any?
|
36
|
+
else
|
27
37
|
evaluation_conditions << evaluate_condition(candidate_component.conditionals[0])
|
28
38
|
candidate_component.uuid if evaluation_conditions.flatten.all?
|
29
|
-
elsif candidate_component.conditionals.count > 1
|
30
|
-
# if there are or rule
|
31
|
-
if candidate_component.conditionals[0][:_type] == 'and'
|
32
|
-
# if there are 'and' in conditions between the 'or' rule
|
33
|
-
candidate_component.conditionals.map do |conditional|
|
34
|
-
evaluation_conditions << evaluate_condition(conditional).flatten.all?
|
35
|
-
end
|
36
|
-
return candidate_component.uuid if evaluation_conditions.flatten.any?
|
37
|
-
end
|
38
|
-
if candidate_component.conditionals[0][:_type] == 'if'
|
39
|
-
# then this is an 'or' condition between conditionals
|
40
|
-
candidate_component.conditionals.map do |conditional|
|
41
|
-
evaluation_conditions << evaluate_condition(conditional)
|
42
|
-
end
|
43
|
-
candidate_component.uuid if evaluation_conditions.flatten.any?
|
44
|
-
end
|
45
39
|
end
|
46
40
|
end
|
47
41
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metadata_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Forms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|