metadata_presenter 2.15.9 → 2.15.12
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/models/metadata_presenter/branch_destinations.rb +4 -0
- data/app/models/metadata_presenter/coordinates.rb +10 -6
- data/app/models/metadata_presenter/grid.rb +6 -3
- data/app/models/metadata_presenter/page.rb +4 -0
- data/app/models/metadata_presenter/row_number.rb +3 -3
- data/app/operators/metadata_presenter/contains_operator.rb +11 -0
- data/app/operators/metadata_presenter/does_not_contain_operator.rb +11 -0
- data/config/initializers/inflections.rb +1 -0
- data/lib/metadata_presenter/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa0c41f4fa6c6480de3cf499e6c1ed023e2bf375eaa37e80fda2af43ed79e2a0
|
4
|
+
data.tar.gz: 6c656d1fdea731a25f81dfa4a83ecb4c140267d7e396245f6871fcc513b52738
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68eccd32be7f6490f708193614752d7c41ffc74cf7992f772ac1d9b1a03a26d2b4866c8d0ed2a37d13ed9f43bd3e79628c2c058412e0f391cd94c56a35fa24a5
|
7
|
+
data.tar.gz: a698125db67640863c49e19b46d8ca99e458a06d9323f2a73252270df98bb7b47018ba26ec90ae9b7999b9a30dd2282063a389a68a73655074f7bd9996cc0adb
|
@@ -39,7 +39,7 @@ module MetadataPresenter
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def set_branch_spacers_column(branch_uuid, column)
|
42
|
-
branch_spacers[branch_uuid].each do |
|
42
|
+
branch_spacers[branch_uuid].each do |position|
|
43
43
|
position[:column] = column
|
44
44
|
end
|
45
45
|
end
|
@@ -50,7 +50,7 @@ module MetadataPresenter
|
|
50
50
|
# to draw an arrow therefore we increment the row number from the branches
|
51
51
|
# calculated starting row
|
52
52
|
def set_branch_spacers_row(branch_uuid, starting_row)
|
53
|
-
branch_spacers[branch_uuid].each.with_index(starting_row) do |
|
53
|
+
branch_spacers[branch_uuid].each.with_index(starting_row) do |position, row|
|
54
54
|
position[:row] = row
|
55
55
|
end
|
56
56
|
end
|
@@ -68,11 +68,15 @@ module MetadataPresenter
|
|
68
68
|
# need an additional line for an arrow.
|
69
69
|
def setup_branch_spacers
|
70
70
|
service.branches.each.with_object({}) do |branch, hash|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
hash[branch.uuid] = initial_spacer(branch)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def initial_spacer(branch)
|
76
|
+
destinations = exiting_destinations_from_branch(branch).map do |uuid|
|
77
|
+
{ uuid: uuid, row: nil, column: nil }
|
75
78
|
end
|
79
|
+
has_or_conditionals?(branch) ? destinations.uniq : destinations
|
76
80
|
end
|
77
81
|
end
|
78
82
|
end
|
@@ -241,9 +241,9 @@ module MetadataPresenter
|
|
241
241
|
column.each do |flow_object|
|
242
242
|
next unless flow_object.branch?
|
243
243
|
|
244
|
-
coordinates.branch_spacers[flow_object.uuid].
|
245
|
-
if replace_with_pointer?(next_column,
|
246
|
-
@ordered[next_column][
|
244
|
+
coordinates.branch_spacers[flow_object.uuid].map do |destination|
|
245
|
+
if replace_with_pointer?(next_column, destination[:row], destination[:uuid])
|
246
|
+
@ordered[next_column][destination[:row]] = MetadataPresenter::Pointer.new(uuid: destination[:uuid])
|
247
247
|
end
|
248
248
|
end
|
249
249
|
end
|
@@ -356,10 +356,13 @@ module MetadataPresenter
|
|
356
356
|
# and arrow. When there are 'OR' conditions we need to insert additional
|
357
357
|
# spacers into the necessary row in the column after the one the branch is
|
358
358
|
# located in.
|
359
|
+
# This is done for the column directly after a branching point
|
359
360
|
def insert_expression_spacers
|
360
361
|
service.branches.each do |branch|
|
361
362
|
next if coordinates.uuid_column(branch.uuid).nil?
|
362
363
|
|
364
|
+
next unless has_or_conditionals?(branch)
|
365
|
+
|
363
366
|
previous_uuid = ''
|
364
367
|
next_column = coordinates.uuid_column(branch.uuid) + 1
|
365
368
|
exiting_destinations_from_branch(branch).each_with_index do |uuid, row|
|
@@ -42,7 +42,7 @@ module MetadataPresenter
|
|
42
42
|
return if branches_in_column.empty?
|
43
43
|
|
44
44
|
row_numbers = branches_in_column.map do |branch_uuid, _|
|
45
|
-
coordinates.branch_spacers[branch_uuid].map { |
|
45
|
+
coordinates.branch_spacers[branch_uuid].map { |position| position[:row] }
|
46
46
|
end
|
47
47
|
row_numbers.flatten.max + 1
|
48
48
|
end
|
@@ -54,7 +54,7 @@ module MetadataPresenter
|
|
54
54
|
def branch_spacer_row
|
55
55
|
return if spacers_for_current_object.empty?
|
56
56
|
|
57
|
-
spacers_for_current_object.map { |position| position[:row] }.max
|
57
|
+
spacers_for_current_object.flatten.map { |position| position[:row] }.max
|
58
58
|
end
|
59
59
|
|
60
60
|
def first_row?
|
@@ -84,7 +84,7 @@ module MetadataPresenter
|
|
84
84
|
end
|
85
85
|
|
86
86
|
current_object_spacers = spacer_positions.map do |branch_uuid, _|
|
87
|
-
coordinates.branch_spacers[branch_uuid][uuid]
|
87
|
+
coordinates.branch_spacers[branch_uuid].select { |branch_spacer| branch_spacer[:uuid] == uuid }
|
88
88
|
end
|
89
89
|
current_object_spacers.compact
|
90
90
|
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.15.
|
4
|
+
version: 2.15.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Forms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|
@@ -303,6 +303,8 @@ files:
|
|
303
303
|
- app/models/metadata_presenter/traversed_pages.rb
|
304
304
|
- app/models/metadata_presenter/uploaded_file.rb
|
305
305
|
- app/operators/metadata_presenter/base_operator.rb
|
306
|
+
- app/operators/metadata_presenter/contains_operator.rb
|
307
|
+
- app/operators/metadata_presenter/does_not_contain_operator.rb
|
306
308
|
- app/operators/metadata_presenter/is_answered_operator.rb
|
307
309
|
- app/operators/metadata_presenter/is_not_answered_operator.rb
|
308
310
|
- app/operators/metadata_presenter/is_not_operator.rb
|