metadata_presenter 2.17.35 → 2.17.36
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 +5 -5
- data/app/controllers/metadata_presenter/engine_controller.rb +1 -1
- data/app/models/metadata_presenter/autocomplete_item.rb +1 -1
- data/app/models/metadata_presenter/coordinates.rb +1 -1
- data/app/models/metadata_presenter/file_uploader.rb +3 -3
- data/app/models/metadata_presenter/grid.rb +9 -9
- data/app/models/metadata_presenter/next_page.rb +2 -2
- data/app/models/metadata_presenter/page.rb +1 -1
- data/app/models/metadata_presenter/page_answers.rb +1 -1
- data/app/models/metadata_presenter/route.rb +9 -9
- data/app/models/metadata_presenter/traversed_pages.rb +2 -2
- data/app/presenters/metadata_presenter/page_answers_presenter.rb +4 -4
- data/app/validators/metadata_presenter/autocomplete_validator.rb +1 -1
- data/app/validators/metadata_presenter/validate_answers.rb +4 -4
- 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: 93bd1410cbf89bbfddbc54da90360e8d864d98e9e4d90ed4b6f49159b4a38f55
|
4
|
+
data.tar.gz: f91d6a77c7a5a823c0344824b04ed9aaec2005896fd66e93ed6f07479c5e1353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f5fc9aea8e4d1bd434ba3579d1c18b46455047325f7bb7be37f67e5a0334e4077c59adca30a9c08f56f32d0dd966f4dff097937cbef70c8b6fa6ecb91c6fbcd
|
7
|
+
data.tar.gz: b64584d58c92f148c147e6436fc50ea08d13f9196753f4052fca86788597a2749a5fc391b8a697d8090740d95fdc8a177757bbfbd4fa98a22373df5d86161a15
|
@@ -27,8 +27,8 @@ module MetadataPresenter
|
|
27
27
|
|
28
28
|
def redirect_to_next_page
|
29
29
|
next_page = NextPage.new(
|
30
|
-
service
|
31
|
-
session
|
30
|
+
service:,
|
31
|
+
session:,
|
32
32
|
user_data: reload_user_data,
|
33
33
|
current_page_url: page_url,
|
34
34
|
previous_answers: @previous_answers
|
@@ -74,13 +74,13 @@ module MetadataPresenter
|
|
74
74
|
@page_answers.answers[component.id] = answer
|
75
75
|
MetadataPresenter::UploadedFile.new(
|
76
76
|
file: @page_answers.send(component.id),
|
77
|
-
component:
|
77
|
+
component:
|
78
78
|
)
|
79
79
|
else
|
80
80
|
FileUploader.new(
|
81
|
-
session
|
81
|
+
session:,
|
82
82
|
page_answers: @page_answers,
|
83
|
-
component
|
83
|
+
component:,
|
84
84
|
adapter: upload_adapter
|
85
85
|
).upload
|
86
86
|
end
|
@@ -76,7 +76,7 @@ module MetadataPresenter
|
|
76
76
|
|
77
77
|
def initial_spacer(branch)
|
78
78
|
destinations = exiting_destinations_from_branch(branch).map do |uuid|
|
79
|
-
{ uuid
|
79
|
+
{ uuid:, row: nil, column: nil }
|
80
80
|
end
|
81
81
|
has_or_conditionals?(branch) ? destinations.uniq : destinations
|
82
82
|
end
|
@@ -4,15 +4,15 @@ module MetadataPresenter
|
|
4
4
|
attr_accessor :session, :page_answers, :component, :adapter
|
5
5
|
|
6
6
|
def upload
|
7
|
-
UploadedFile.new(file: upload_file, component:
|
7
|
+
UploadedFile.new(file: upload_file, component:)
|
8
8
|
end
|
9
9
|
|
10
10
|
def upload_file
|
11
11
|
return {} if file_details.blank?
|
12
12
|
|
13
13
|
adapter.new(
|
14
|
-
session
|
15
|
-
file_details
|
14
|
+
session:,
|
15
|
+
file_details:,
|
16
16
|
allowed_file_types: component.validation['accept']
|
17
17
|
).call
|
18
18
|
end
|
@@ -94,7 +94,7 @@ module MetadataPresenter
|
|
94
94
|
def route_from_start
|
95
95
|
@route_from_start ||=
|
96
96
|
MetadataPresenter::Route.new(
|
97
|
-
service
|
97
|
+
service:,
|
98
98
|
traverse_from: start_from || service.start_page.uuid
|
99
99
|
)
|
100
100
|
end
|
@@ -155,10 +155,10 @@ module MetadataPresenter
|
|
155
155
|
@routes.each do |route|
|
156
156
|
route.flow_uuids.each.with_index(route.column) do |uuid, new_column|
|
157
157
|
column_number = MetadataPresenter::ColumnNumber.new(
|
158
|
-
uuid
|
159
|
-
new_column
|
158
|
+
uuid:,
|
159
|
+
new_column:,
|
160
160
|
coordinates: @coordinates,
|
161
|
-
service:
|
161
|
+
service:
|
162
162
|
).number
|
163
163
|
@coordinates.set_column(uuid, column_number)
|
164
164
|
end
|
@@ -172,11 +172,11 @@ module MetadataPresenter
|
|
172
172
|
current_row = route.row
|
173
173
|
route.flow_uuids.each do |uuid|
|
174
174
|
row_number = MetadataPresenter::RowNumber.new(
|
175
|
-
uuid
|
176
|
-
route
|
177
|
-
current_row
|
175
|
+
uuid:,
|
176
|
+
route:,
|
177
|
+
current_row:,
|
178
178
|
coordinates: @coordinates,
|
179
|
-
service:
|
179
|
+
service:
|
180
180
|
).number
|
181
181
|
@coordinates.set_row(uuid, row_number)
|
182
182
|
|
@@ -244,7 +244,7 @@ module MetadataPresenter
|
|
244
244
|
|
245
245
|
def get_flow_object(uuid)
|
246
246
|
# main_flow is always empty if the Grid is _actually_ building the main flow
|
247
|
-
return MetadataPresenter::Pointer.new(uuid:
|
247
|
+
return MetadataPresenter::Pointer.new(uuid:) if main_flow.include?(uuid)
|
248
248
|
|
249
249
|
service.flow_object(uuid)
|
250
250
|
end
|
@@ -125,7 +125,7 @@ module MetadataPresenter
|
|
125
125
|
def to_components(node_components, collection:)
|
126
126
|
Array(node_components).map do |component|
|
127
127
|
MetadataPresenter::Component.new(
|
128
|
-
component.merge(collection:
|
128
|
+
component.merge(collection:),
|
129
129
|
editor: editor?
|
130
130
|
)
|
131
131
|
end
|
@@ -13,7 +13,7 @@ module MetadataPresenter
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def validate_answers
|
16
|
-
ValidateAnswers.new(self, components
|
16
|
+
ValidateAnswers.new(self, components:, autocomplete_items:).valid?
|
17
17
|
end
|
18
18
|
|
19
19
|
delegate :components, to: :page
|
@@ -42,8 +42,8 @@ module MetadataPresenter
|
|
42
42
|
set_first_conditional_previous_flow(flow_object.uuid, first_conditional)
|
43
43
|
create_destination_routes(
|
44
44
|
previous_flow_uuid: flow_object.uuid,
|
45
|
-
destinations
|
46
|
-
row
|
45
|
+
destinations:,
|
46
|
+
row:,
|
47
47
|
column: index
|
48
48
|
)
|
49
49
|
|
@@ -78,15 +78,15 @@ module MetadataPresenter
|
|
78
78
|
def set_first_conditional_previous_flow(previous_flow_uuid, first_conditional)
|
79
79
|
set_previous_flow(
|
80
80
|
uuid: first_conditional[:next],
|
81
|
-
previous_flow_uuid
|
81
|
+
previous_flow_uuid:,
|
82
82
|
conditional_uuid: first_conditional[:conditional_uuid]
|
83
83
|
)
|
84
84
|
end
|
85
85
|
|
86
86
|
def set_previous_flow(uuid:, previous_flow_uuid:, conditional_uuid: nil)
|
87
87
|
previous_uuids[uuid] = {
|
88
|
-
previous_flow_uuid
|
89
|
-
conditional_uuid:
|
88
|
+
previous_flow_uuid:,
|
89
|
+
conditional_uuid:
|
90
90
|
}
|
91
91
|
end
|
92
92
|
|
@@ -104,9 +104,9 @@ module MetadataPresenter
|
|
104
104
|
destinations.each do |destination|
|
105
105
|
@routes.push(
|
106
106
|
MetadataPresenter::Route.new(
|
107
|
-
service
|
107
|
+
service:,
|
108
108
|
traverse_from: destination[:next],
|
109
|
-
previous_flow_uuid
|
109
|
+
previous_flow_uuid:,
|
110
110
|
conditional_uuid: destination[:conditional_uuid],
|
111
111
|
row: row_number,
|
112
112
|
column: column_number
|
@@ -120,8 +120,8 @@ module MetadataPresenter
|
|
120
120
|
Hash[
|
121
121
|
traverse_from,
|
122
122
|
{
|
123
|
-
previous_flow_uuid
|
124
|
-
conditional_uuid:
|
123
|
+
previous_flow_uuid:,
|
124
|
+
conditional_uuid:
|
125
125
|
}
|
126
126
|
]
|
127
127
|
end
|
@@ -12,10 +12,10 @@ module MetadataPresenter
|
|
12
12
|
user_input_pages(pages).map { |page|
|
13
13
|
Array(page.supported_components_by_type(:input)).map do |component|
|
14
14
|
new(
|
15
|
-
view
|
16
|
-
component
|
17
|
-
page
|
18
|
-
answers:
|
15
|
+
view:,
|
16
|
+
component:,
|
17
|
+
page:,
|
18
|
+
answers:
|
19
19
|
)
|
20
20
|
end
|
21
21
|
}.reject(&:empty?)
|
@@ -3,7 +3,7 @@ module MetadataPresenter
|
|
3
3
|
attr_reader :autocomplete_items
|
4
4
|
|
5
5
|
def initialize(page_answers:, component:, autocomplete_items:)
|
6
|
-
super(page_answers
|
6
|
+
super(page_answers:, component:)
|
7
7
|
|
8
8
|
@autocomplete_items = autocomplete_items
|
9
9
|
end
|
@@ -22,9 +22,9 @@ module MetadataPresenter
|
|
22
22
|
components.map { |component|
|
23
23
|
component_validations(component).map do |key|
|
24
24
|
"MetadataPresenter::#{key.classify}Validator".constantize.new(
|
25
|
-
{
|
26
|
-
|
27
|
-
|
25
|
+
**{
|
26
|
+
page_answers:,
|
27
|
+
component:
|
28
28
|
}.merge(autocomplete_param(key))
|
29
29
|
)
|
30
30
|
end
|
@@ -38,7 +38,7 @@ module MetadataPresenter
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def autocomplete_param(key)
|
41
|
-
key == 'autocomplete' ? { autocomplete_items:
|
41
|
+
key == 'autocomplete' ? { autocomplete_items: } : {}
|
42
42
|
end
|
43
43
|
end
|
44
44
|
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.17.
|
4
|
+
version: 2.17.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Forms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|