metadata_presenter 2.15.9 → 2.15.10
Sign up to get free protection for your applications and to get access to all the features.
- 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/row_number.rb +3 -3
- 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: 53b941c0d91360e25ea0fbe443046805d760416cc4c345813fe44ade9dca178e
|
4
|
+
data.tar.gz: 4c7e831b1cad1f8d8587e30196cb99d980463addd0b7451f54511cfe7e688603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6188728e5ee91a652462c9abea6ff0900c2393549a8544f4c7ec5b72d7723d99ee69b2a6cb1bd0d9027756175966cc561bce28e3100d50a1fa93a349a3d6f7c
|
7
|
+
data.tar.gz: b861587b148d28738d7ffe62bf83aad31305b6962fba31f4bea910d8b0023cc61e2ea3ccece69c323f72deee065e7437530658328e98acef3569b0d663a4f539
|
@@ -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.10
|
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-02-
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|