metadata_presenter 2.12.1 → 2.13.0
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: 92db6bbc2b6ecefe9836a96c3014b94cc43c48a2fb4e82152f71bea00d6b3bc4
|
4
|
+
data.tar.gz: f9a2d946f0bf343f4a20f943f2aed35d3fce8ddbc42cf28997b10f10bfa3f9ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b94a4afee1f43a692360645775bb5555c3c722f93a5c1f2c0cb865af90e43448d5eb1bab458eb022c49d76a39348497f2946ca925afdf11fd8ed5f8749ef0f4
|
7
|
+
data.tar.gz: 10ad22eada3869215e8d7ef9e00dc578468d142b7c3d151c9ba8590ad001101570e317f1b7b1f2dd5343572608ba4e1464383f8c57acbb317aa160cd2ab85157
|
@@ -11,6 +11,12 @@ module MetadataPresenter
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
class Warning < OpenStruct
|
15
|
+
def type
|
16
|
+
'flow.warning'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
14
20
|
class Grid
|
15
21
|
include BranchDestinations
|
16
22
|
attr_reader :start_from
|
@@ -37,13 +43,14 @@ module MetadataPresenter
|
|
37
43
|
insert_expression_spacers
|
38
44
|
trim_pointers unless main_flow.empty?
|
39
45
|
trim_spacers
|
46
|
+
insert_warning if main_flow.empty?
|
40
47
|
|
41
48
|
@ordered = @ordered.reject(&:empty?)
|
42
49
|
end
|
43
50
|
|
44
51
|
def ordered_flow
|
45
52
|
@ordered_flow ||=
|
46
|
-
build.flatten.reject { |obj| obj.is_a?(MetadataPresenter::Spacer) }
|
53
|
+
build.flatten.reject { |obj| obj.is_a?(MetadataPresenter::Spacer) || obj.is_a?(MetadataPresenter::Warning) }
|
47
54
|
end
|
48
55
|
|
49
56
|
def ordered_pages
|
@@ -263,6 +270,51 @@ module MetadataPresenter
|
|
263
270
|
@ordered[column].insert(row, MetadataPresenter::Spacer.new)
|
264
271
|
end
|
265
272
|
|
273
|
+
# Include a warning if a service does not have a CYA or Confirmation page in the
|
274
|
+
# main flow. The warning should always be in the first row, last column.
|
275
|
+
def insert_warning
|
276
|
+
if cya_and_confirmation_pages_not_in_service? ||
|
277
|
+
cya_and_confirmation_pages_detached?
|
278
|
+
@ordered.append([MetadataPresenter::Warning.new])
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
def cya_and_confirmation_pages_not_in_service?
|
283
|
+
(checkanswers_not_in_service? && confirmation_not_in_service?) ||
|
284
|
+
checkanswers_not_in_service? ||
|
285
|
+
confirmation_not_in_service?
|
286
|
+
end
|
287
|
+
|
288
|
+
def checkanswers_not_in_service?
|
289
|
+
service.checkanswers_page.blank?
|
290
|
+
end
|
291
|
+
|
292
|
+
def confirmation_not_in_service?
|
293
|
+
service.confirmation_page.blank?
|
294
|
+
end
|
295
|
+
|
296
|
+
def cya_and_confirmation_pages_detached?
|
297
|
+
(checkanswers_detached? && confirmation_detached?) ||
|
298
|
+
checkanswers_detached? ||
|
299
|
+
confirmation_detached?
|
300
|
+
end
|
301
|
+
|
302
|
+
def checkanswers_detached?
|
303
|
+
if service.checkanswers_page.present?
|
304
|
+
uuid = service.checkanswers_page.uuid
|
305
|
+
position = coordinates.position(uuid)
|
306
|
+
detached?(position)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
def confirmation_detached?
|
311
|
+
if service.confirmation_page.present?
|
312
|
+
uuid = service.confirmation_page.uuid
|
313
|
+
position = coordinates.position(uuid)
|
314
|
+
detached?(position)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
266
318
|
# Any destinations exiting the branch that have not already been traversed.
|
267
319
|
# This removes any branch destinations that already exist on other rows. If
|
268
320
|
# that is the case then the arrow will flow towards whatever row that object
|
@@ -60,6 +60,12 @@ class MetadataPresenter::Service < MetadataPresenter::Metadata
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
def checkanswers_page
|
64
|
+
@checkanswers_page ||= pages.find do |page|
|
65
|
+
page.type == 'page.checkanswers'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
63
69
|
def meta
|
64
70
|
MetadataPresenter::Meta.new(configuration['meta'])
|
65
71
|
end
|
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: 2.
|
4
|
+
version: 2.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Forms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|