metadata_presenter 1.7.0 → 1.7.5
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/flow.rb +1 -1
- data/app/models/metadata_presenter/next_page.rb +2 -2
- data/app/models/metadata_presenter/page_answers.rb +5 -4
- data/app/models/metadata_presenter/previous_page.rb +1 -5
- data/app/models/metadata_presenter/service.rb +2 -2
- data/app/models/metadata_presenter/traversed_pages.rb +2 -2
- data/config/initializers/default_metadata.rb +5 -2
- data/default_metadata/flow/branch.json +7 -0
- data/default_metadata/flow/condition.json +5 -0
- data/default_metadata/flow/criteria.json +6 -0
- data/default_metadata/flow/page.json +6 -0
- data/fixtures/branching.json +229 -27
- data/fixtures/no_flow_service.json +190 -0
- data/lib/metadata_presenter/version.rb +1 -1
- data/lib/tasks/metadata_presenter_tasks.rake +8 -8
- data/schemas/flow/base.json +24 -0
- data/schemas/flow/branch.json +75 -0
- data/schemas/flow/page.json +22 -0
- data/schemas/service/base.json +4 -2
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86a854cda58e43b201b7822776e20af692ea00f7e95bed976bf546d0bb2259c4
|
4
|
+
data.tar.gz: cf833a226b554e172ba02d4d24b4c1a6a611b44033d5fa7c253d4739fa3c4723
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa52155a487fe1d8f9cc20249f8e13ae421ea4c26bd0ce60f8cc80b45fc78cda45a5bbed43172bfa24559807fd7d90d33c573ede095a0d1525150ec26b09d191
|
7
|
+
data.tar.gz: 26cf5ce6a264158f9fe45bf96420bbc4cf25e988b8030144eb920ec1fb327731235efcf81dafd52165b17b21560c30561714b9de28236706559e65872a99609f
|
@@ -49,11 +49,11 @@ module MetadataPresenter
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def current_page_flow
|
52
|
-
service.
|
52
|
+
service.flow_object(current_page_uuid)
|
53
53
|
end
|
54
54
|
|
55
55
|
def next_flow
|
56
|
-
service.
|
56
|
+
service.flow_object(current_page_flow.default_next)
|
57
57
|
end
|
58
58
|
|
59
59
|
def next_flow_branch_object?
|
@@ -2,6 +2,7 @@ module MetadataPresenter
|
|
2
2
|
class PageAnswers
|
3
3
|
include ActiveModel::Model
|
4
4
|
include ActiveModel::Validations
|
5
|
+
include ActionView::Helpers
|
5
6
|
attr_reader :page, :answers, :uploaded_files
|
6
7
|
|
7
8
|
def initialize(page, answers)
|
@@ -30,7 +31,7 @@ module MetadataPresenter
|
|
30
31
|
elsif component && component.type == 'checkboxes'
|
31
32
|
answers[method_name.to_s].to_a
|
32
33
|
else
|
33
|
-
answers[method_name.to_s]
|
34
|
+
sanitize(answers[method_name.to_s])
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
@@ -40,10 +41,10 @@ module MetadataPresenter
|
|
40
41
|
return {} unless file_details
|
41
42
|
|
42
43
|
if file_details.is_a?(Hash) || file_details.is_a?(ActionController::Parameters)
|
43
|
-
file_details
|
44
|
+
file_details.merge('original_filename' => sanitize(file_details['original_filename']))
|
44
45
|
else
|
45
46
|
{
|
46
|
-
'original_filename' => file_details.original_filename,
|
47
|
+
'original_filename' => sanitize(file_details.original_filename),
|
47
48
|
'content_type' => file_details.content_type,
|
48
49
|
'tempfile' => file_details.tempfile.path.to_s
|
49
50
|
}
|
@@ -62,7 +63,7 @@ module MetadataPresenter
|
|
62
63
|
GOVUKDesignSystemFormBuilder::Elements::Date::SEGMENTS[:month],
|
63
64
|
GOVUKDesignSystemFormBuilder::Elements::Date::SEGMENTS[:year]
|
64
65
|
].map do |segment|
|
65
|
-
answers["#{component_id}(#{segment})"]
|
66
|
+
sanitize(answers["#{component_id}(#{segment})"])
|
66
67
|
end
|
67
68
|
end
|
68
69
|
end
|
@@ -7,7 +7,7 @@ module MetadataPresenter
|
|
7
7
|
# what happens when a user enters in the middle of the flow
|
8
8
|
return if no_current_or_referrer_pages? || service.no_back_link?(current_page)
|
9
9
|
|
10
|
-
if flow.present?
|
10
|
+
if service.flow.present?
|
11
11
|
return referrer_page if return_to_referrer?
|
12
12
|
|
13
13
|
TraversedPages.new(service, user_data, current_page).last
|
@@ -16,10 +16,6 @@ module MetadataPresenter
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def flow
|
20
|
-
service.metadata['flow']
|
21
|
-
end
|
22
|
-
|
23
19
|
private
|
24
20
|
|
25
21
|
def referrer_page
|
@@ -5,8 +5,8 @@ class MetadataPresenter::Service < MetadataPresenter::Metadata
|
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
9
|
-
MetadataPresenter::Flow.new(metadata.flow[
|
8
|
+
def flow_object(uuid)
|
9
|
+
MetadataPresenter::Flow.new(metadata.flow[uuid])
|
10
10
|
rescue StandardError
|
11
11
|
nil
|
12
12
|
end
|
@@ -14,10 +14,10 @@ module MetadataPresenter
|
|
14
14
|
def all
|
15
15
|
page_uuid = service.start_page.uuid
|
16
16
|
|
17
|
-
service.
|
17
|
+
service.flow.size.times do
|
18
18
|
break if page_uuid == current_page.uuid
|
19
19
|
|
20
|
-
flow_object = service.
|
20
|
+
flow_object = service.flow_object(page_uuid)
|
21
21
|
|
22
22
|
if flow_object.branch?
|
23
23
|
page = EvaluateConditions.new(
|
@@ -6,8 +6,11 @@ Rails.logger.info('Loading default metadata')
|
|
6
6
|
default_metadata = Dir.glob("#{Rails.application.config.default_metadata_directory}/*/**")
|
7
7
|
default_metadata.each do |metadata_file|
|
8
8
|
metadata = JSON.parse(File.read(metadata_file))
|
9
|
-
|
10
|
-
|
9
|
+
|
10
|
+
key = metadata['_id'] || metadata['_type']
|
11
|
+
Rails.logger.info(key)
|
12
|
+
|
13
|
+
Rails.application.config.default_metadata[key] = metadata
|
11
14
|
end
|
12
15
|
|
13
16
|
Rails.logger.info(
|
data/fixtures/branching.json
CHANGED
@@ -3,25 +3,25 @@
|
|
3
3
|
"_type": "service.base",
|
4
4
|
"flow": {
|
5
5
|
"cf6dc32f-502c-4215-8c27-1151a45735bb": {
|
6
|
-
"_type": "page",
|
6
|
+
"_type": "flow.page",
|
7
7
|
"next": {
|
8
8
|
"default": "9e1ba77f-f1e5-42f4-b090-437aa9af7f73"
|
9
9
|
}
|
10
10
|
},
|
11
11
|
"9e1ba77f-f1e5-42f4-b090-437aa9af7f73": {
|
12
|
-
"_type": "page",
|
12
|
+
"_type": "flow.page",
|
13
13
|
"next": {
|
14
14
|
"default": "68fbb180-9a2a-48f6-9da6-545e28b8d35a"
|
15
15
|
}
|
16
16
|
},
|
17
17
|
"68fbb180-9a2a-48f6-9da6-545e28b8d35a": {
|
18
|
-
"_type": "page",
|
18
|
+
"_type": "flow.page",
|
19
19
|
"next": {
|
20
20
|
"default": "09e91fd9-7a46-4840-adbc-244d545cfef7"
|
21
21
|
}
|
22
22
|
},
|
23
23
|
"09e91fd9-7a46-4840-adbc-244d545cfef7": {
|
24
|
-
"_type": "branch",
|
24
|
+
"_type": "flow.branch",
|
25
25
|
"next": {
|
26
26
|
"default": "0b297048-aa4d-49b6-ac74-18e069118185",
|
27
27
|
"conditions": [
|
@@ -41,19 +41,19 @@
|
|
41
41
|
}
|
42
42
|
},
|
43
43
|
"e8708909-922e-4eaf-87a5-096f7a713fcb": {
|
44
|
-
"_type": "page",
|
44
|
+
"_type": "flow.page",
|
45
45
|
"next": {
|
46
46
|
"default": "0b297048-aa4d-49b6-ac74-18e069118185"
|
47
47
|
}
|
48
48
|
},
|
49
49
|
"0b297048-aa4d-49b6-ac74-18e069118185": {
|
50
|
-
"_type": "page",
|
50
|
+
"_type": "flow.page",
|
51
51
|
"next": {
|
52
52
|
"default": "ffadeb22-063b-4e4f-9502-bd753c706b1d"
|
53
53
|
}
|
54
54
|
},
|
55
55
|
"ffadeb22-063b-4e4f-9502-bd753c706b1d": {
|
56
|
-
"_type": "branch",
|
56
|
+
"_type": "flow.branch",
|
57
57
|
"next": {
|
58
58
|
"default": "05c3306c-0a39-42d2-9e0f-93fd49248f4e",
|
59
59
|
"conditions": [
|
@@ -85,25 +85,25 @@
|
|
85
85
|
}
|
86
86
|
},
|
87
87
|
"d4342dfd-0d09-4a91-a0ea-d7fd67e706cc": {
|
88
|
-
"_type": "page",
|
88
|
+
"_type": "flow.page",
|
89
89
|
"next": {
|
90
90
|
"default": "05c3306c-0a39-42d2-9e0f-93fd49248f4e"
|
91
91
|
}
|
92
92
|
},
|
93
93
|
"91e9f7c6-2f75-4b7d-9eb5-0cf352f7be66": {
|
94
|
-
"_type": "page",
|
94
|
+
"_type": "flow.page",
|
95
95
|
"next": {
|
96
96
|
"default": "05c3306c-0a39-42d2-9e0f-93fd49248f4e"
|
97
97
|
}
|
98
98
|
},
|
99
99
|
"05c3306c-0a39-42d2-9e0f-93fd49248f4e": {
|
100
|
-
"_type": "page",
|
100
|
+
"_type": "flow.page",
|
101
101
|
"next": {
|
102
102
|
"default": "1d02e508-5953-4eca-af2f-9d67511c8648"
|
103
103
|
}
|
104
104
|
},
|
105
105
|
"1d02e508-5953-4eca-af2f-9d67511c8648": {
|
106
|
-
"_type": "branch",
|
106
|
+
"_type": "flow.branch",
|
107
107
|
"next": {
|
108
108
|
"default": "ef2cafe3-37e2-4533-9b0c-09a970cd38d4",
|
109
109
|
"conditions": [
|
@@ -123,19 +123,19 @@
|
|
123
123
|
}
|
124
124
|
},
|
125
125
|
"8002df6e-29ab-4cdf-b520-1d7bb931a28f": {
|
126
|
-
"_type": "page",
|
126
|
+
"_type": "flow.page",
|
127
127
|
"next": {
|
128
128
|
"default": "ef2cafe3-37e2-4533-9b0c-09a970cd38d4"
|
129
129
|
}
|
130
130
|
},
|
131
131
|
"ef2cafe3-37e2-4533-9b0c-09a970cd38d4": {
|
132
|
-
"_type": "page",
|
132
|
+
"_type": "flow.page",
|
133
133
|
"next": {
|
134
134
|
"default": "cf8b3e18-dacf-4e91-92e1-018035961003"
|
135
135
|
}
|
136
136
|
},
|
137
137
|
"cf8b3e18-dacf-4e91-92e1-018035961003": {
|
138
|
-
"_type": "branch",
|
138
|
+
"_type": "flow.branch",
|
139
139
|
"next": {
|
140
140
|
"default": "0c022e95-0748-4dda-8ba5-12fd1d2f596b",
|
141
141
|
"conditions": [
|
@@ -155,19 +155,19 @@
|
|
155
155
|
}
|
156
156
|
},
|
157
157
|
"b5efc09c-ece7-45ae-b0b3-8a7905e25040": {
|
158
|
-
"_type": "page",
|
158
|
+
"_type": "flow.page",
|
159
159
|
"next": {
|
160
160
|
"default": "0c022e95-0748-4dda-8ba5-12fd1d2f596b"
|
161
161
|
}
|
162
162
|
},
|
163
163
|
"0c022e95-0748-4dda-8ba5-12fd1d2f596b": {
|
164
|
-
"_type": "page",
|
164
|
+
"_type": "flow.page",
|
165
165
|
"next": {
|
166
166
|
"default": "618b7537-b42b-4551-ae7d-053afa4d9ca9"
|
167
167
|
}
|
168
168
|
},
|
169
169
|
"618b7537-b42b-4551-ae7d-053afa4d9ca9": {
|
170
|
-
"_type": "branch",
|
170
|
+
"_type": "flow.branch",
|
171
171
|
"next": {
|
172
172
|
"default": "dc7454f9-4186-48d7-b055-684d57bbcdc7",
|
173
173
|
"conditions": [
|
@@ -199,27 +199,27 @@
|
|
199
199
|
}
|
200
200
|
},
|
201
201
|
"bc666714-c0a2-4674-afe5-faff2e20d847": {
|
202
|
-
"_type": "page",
|
202
|
+
"_type": "flow.page",
|
203
203
|
"next": {
|
204
204
|
"default": "dc7454f9-4186-48d7-b055-684d57bbcdc7"
|
205
205
|
}
|
206
206
|
},
|
207
207
|
"e2887f44-5e8d-4dc0-b1de-496ab6039430": {
|
208
|
-
"_type": "page",
|
208
|
+
"_type": "flow.page",
|
209
209
|
"next": {
|
210
210
|
"default": "dc7454f9-4186-48d7-b055-684d57bbcdc7"
|
211
211
|
}
|
212
212
|
},
|
213
213
|
"dc7454f9-4186-48d7-b055-684d57bbcdc7": {
|
214
|
-
"_type": "page",
|
214
|
+
"_type": "flow.page",
|
215
215
|
"next": {
|
216
216
|
"default": "84a347fc-8d4b-486a-9996-6a86fa9544c5"
|
217
217
|
}
|
218
218
|
},
|
219
219
|
"84a347fc-8d4b-486a-9996-6a86fa9544c5": {
|
220
|
-
"_type": "branch",
|
220
|
+
"_type": "flow.branch",
|
221
221
|
"next": {
|
222
|
-
"default": "
|
222
|
+
"default": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb",
|
223
223
|
"conditions": [
|
224
224
|
{
|
225
225
|
"condition_type": "or",
|
@@ -261,25 +261,99 @@
|
|
261
261
|
}
|
262
262
|
},
|
263
263
|
"2cc66e51-2c14-4023-86bf-ded49887cdb2": {
|
264
|
-
"_type": "page",
|
264
|
+
"_type": "flow.page",
|
265
265
|
"next": {
|
266
|
-
"default": "
|
266
|
+
"default": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb"
|
267
267
|
}
|
268
268
|
},
|
269
269
|
"f6c51f88-7be8-4cb7-bbfc-6c905727a051": {
|
270
|
-
"_type": "page",
|
270
|
+
"_type": "flow.page",
|
271
|
+
"next": {
|
272
|
+
"default": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb"
|
273
|
+
}
|
274
|
+
},
|
275
|
+
"48357db5-7c06-4e85-94b1-5e1c9d8f39eb": {
|
276
|
+
"_type": "flow.page",
|
277
|
+
"next": {
|
278
|
+
"default": "1079b5b8-abd0-4bf6-aaac-1f01e69e3b39"
|
279
|
+
}
|
280
|
+
},
|
281
|
+
"1079b5b8-abd0-4bf6-aaac-1f01e69e3b39": {
|
282
|
+
"_type": "flow.branch",
|
283
|
+
"next": {
|
284
|
+
"default": "941137d7-a1da-43fd-994a-98a4f9ea6d46",
|
285
|
+
"conditions": [
|
286
|
+
{
|
287
|
+
"condition_type": "and",
|
288
|
+
"next": "56e80942-d0a4-405a-85cd-bd1b100013d6",
|
289
|
+
"criterias": [
|
290
|
+
{
|
291
|
+
"operator": "is",
|
292
|
+
"page": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb",
|
293
|
+
"component": "3a430712-a75f-4412-836d-4ec7b2cb1ac9",
|
294
|
+
"field": "30258b55-ec04-4278-86b7-8382cbd34bea"
|
295
|
+
},
|
296
|
+
{
|
297
|
+
"operator": "is",
|
298
|
+
"page": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb",
|
299
|
+
"component": "3a430712-a75f-4412-836d-4ec7b2cb1ac9",
|
300
|
+
"field": "9339d86e-b53c-42c0-ab6e-1ab3e2340873"
|
301
|
+
},
|
302
|
+
{
|
303
|
+
"operator": "is",
|
304
|
+
"page": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb",
|
305
|
+
"component": "3a430712-a75f-4412-836d-4ec7b2cb1ac9",
|
306
|
+
"field": "5d650e5d-57ac-42a1-9348-c1b93248753a"
|
307
|
+
}
|
308
|
+
]
|
309
|
+
},
|
310
|
+
{
|
311
|
+
"condition_type": "or",
|
312
|
+
"next": "6324cca4-7770-4765-89b9-1cdc41f49c8b",
|
313
|
+
"criterias": [
|
314
|
+
{
|
315
|
+
"operator": "is",
|
316
|
+
"page": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb",
|
317
|
+
"component": "3a430712-a75f-4412-836d-4ec7b2cb1ac9",
|
318
|
+
"field": "6b82b4e4-6dfd-4b3c-b6ed-2d71be0980bf"
|
319
|
+
},
|
320
|
+
{
|
321
|
+
"operator": "is",
|
322
|
+
"page": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb",
|
323
|
+
"component": "3a430712-a75f-4412-836d-4ec7b2cb1ac9",
|
324
|
+
"field": "8c2c6161-7309-4e4f-9f3c-9fa629bcb459"
|
325
|
+
}
|
326
|
+
]
|
327
|
+
}
|
328
|
+
]
|
329
|
+
}
|
330
|
+
},
|
331
|
+
"941137d7-a1da-43fd-994a-98a4f9ea6d46": {
|
332
|
+
"_type": "flow.page",
|
333
|
+
"next": {
|
334
|
+
"default": "e337070b-f636-49a3-a65c-f506675265f0"
|
335
|
+
}
|
336
|
+
},
|
337
|
+
"56e80942-d0a4-405a-85cd-bd1b100013d6": {
|
338
|
+
"_type": "flow.page",
|
339
|
+
"next": {
|
340
|
+
"default": "e337070b-f636-49a3-a65c-f506675265f0"
|
341
|
+
}
|
342
|
+
},
|
343
|
+
"6324cca4-7770-4765-89b9-1cdc41f49c8b": {
|
344
|
+
"_type": "flow.page",
|
271
345
|
"next": {
|
272
346
|
"default": "e337070b-f636-49a3-a65c-f506675265f0"
|
273
347
|
}
|
274
348
|
},
|
275
349
|
"e337070b-f636-49a3-a65c-f506675265f0": {
|
276
|
-
"_type": "page",
|
350
|
+
"_type": "flow.page",
|
277
351
|
"next": {
|
278
352
|
"default": "778e364b-9a7f-4829-8eb2-510e08f156a3"
|
279
353
|
}
|
280
354
|
},
|
281
355
|
"778e364b-9a7f-4829-8eb2-510e08f156a3": {
|
282
|
-
"_type": "page",
|
356
|
+
"_type": "flow.page",
|
283
357
|
"next": {
|
284
358
|
"default": ""
|
285
359
|
}
|
@@ -482,6 +556,7 @@
|
|
482
556
|
"url": "favourite-fruit",
|
483
557
|
"_type": "page.singlequestion",
|
484
558
|
"_uuid": "0b297048-aa4d-49b6-ac74-18e069118185",
|
559
|
+
"heading": "",
|
485
560
|
"components": [
|
486
561
|
{
|
487
562
|
"_id": "favourite-fruit_radios_1",
|
@@ -525,6 +600,7 @@
|
|
525
600
|
"url": "apple-juice",
|
526
601
|
"_type": "page.singlequestion",
|
527
602
|
"_uuid": "d4342dfd-0d09-4a91-a0ea-d7fd67e706cc",
|
603
|
+
"heading": "",
|
528
604
|
"components": [
|
529
605
|
{
|
530
606
|
"_id": "apple-juice_radios_1",
|
@@ -561,6 +637,7 @@
|
|
561
637
|
"url": "orange-juice",
|
562
638
|
"_type": "page.singlequestion",
|
563
639
|
"_uuid": "91e9f7c6-2f75-4b7d-9eb5-0cf352f7be66",
|
640
|
+
"heading": "",
|
564
641
|
"components": [
|
565
642
|
{
|
566
643
|
"_id": "orange-juice_radios_1",
|
@@ -597,6 +674,7 @@
|
|
597
674
|
"url": "favourite-band",
|
598
675
|
"_type": "page.singlequestion",
|
599
676
|
"_uuid": "05c3306c-0a39-42d2-9e0f-93fd49248f4e",
|
677
|
+
"heading": "",
|
600
678
|
"components": [
|
601
679
|
{
|
602
680
|
"_id": "favourite-band_radios_1",
|
@@ -633,6 +711,7 @@
|
|
633
711
|
"url": "music-app",
|
634
712
|
"_type": "page.singlequestion",
|
635
713
|
"_uuid": "8002df6e-29ab-4cdf-b520-1d7bb931a28f",
|
714
|
+
"heading": "",
|
636
715
|
"components": [
|
637
716
|
{
|
638
717
|
"_id": "music-app_radios_1",
|
@@ -669,6 +748,7 @@
|
|
669
748
|
"url": "best-formbuilder",
|
670
749
|
"_type": "page.singlequestion",
|
671
750
|
"_uuid": "ef2cafe3-37e2-4533-9b0c-09a970cd38d4",
|
751
|
+
"heading": "",
|
672
752
|
"components": [
|
673
753
|
{
|
674
754
|
"_id": "best-formbuilder_radios_1",
|
@@ -840,6 +920,7 @@
|
|
840
920
|
"url": "marvel-series",
|
841
921
|
"_type": "page.singlequestion",
|
842
922
|
"_uuid": "dc7454f9-4186-48d7-b055-684d57bbcdc7",
|
923
|
+
"heading": "",
|
843
924
|
"components": [
|
844
925
|
{
|
845
926
|
"_id": "marvel-series_radios_1",
|
@@ -937,6 +1018,127 @@
|
|
937
1018
|
],
|
938
1019
|
"section_heading": ""
|
939
1020
|
},
|
1021
|
+
{
|
1022
|
+
"_id": "page.best-arnold-quote",
|
1023
|
+
"url": "best-arnold-quote",
|
1024
|
+
"body": "Body section",
|
1025
|
+
"lede": "",
|
1026
|
+
"_type": "page.singlequestion",
|
1027
|
+
"_uuid": "48357db5-7c06-4e85-94b1-5e1c9d8f39eb",
|
1028
|
+
"heading": "Question",
|
1029
|
+
"components": [
|
1030
|
+
{
|
1031
|
+
"_id": "best-arnold-quote_checkboxes_1",
|
1032
|
+
"hint": "",
|
1033
|
+
"name": "best-arnold-quote_checkboxes_1",
|
1034
|
+
"_type": "checkboxes",
|
1035
|
+
"_uuid": "3a430712-a75f-4412-836d-4ec7b2cb1ac9",
|
1036
|
+
"items": [
|
1037
|
+
{
|
1038
|
+
"_id": "best-arnold-quote_checkboxes_1_item_1",
|
1039
|
+
"hint": "",
|
1040
|
+
"name": "best-arnold-quote_checkboxes_1",
|
1041
|
+
"_type": "checkbox",
|
1042
|
+
"_uuid": "30258b55-ec04-4278-86b7-8382cbd34bea",
|
1043
|
+
"label": "You are not you. You are me"
|
1044
|
+
},
|
1045
|
+
{
|
1046
|
+
"_id": "best-arnold-quote_checkboxes_1_item_2",
|
1047
|
+
"hint": "",
|
1048
|
+
"name": "best-arnold-quote_checkboxes_1",
|
1049
|
+
"_type": "checkbox",
|
1050
|
+
"_uuid": "9339d86e-b53c-42c0-ab6e-1ab3e2340873",
|
1051
|
+
"label": "Get to the chopper"
|
1052
|
+
},
|
1053
|
+
{
|
1054
|
+
"_id": "best-arnold-quote_checkboxes_1_item_3",
|
1055
|
+
"hint": "",
|
1056
|
+
"name": "best-arnold-quote_checkboxes_1",
|
1057
|
+
"_type": "checkbox",
|
1058
|
+
"_uuid": "5d650e5d-57ac-42a1-9348-c1b93248753a",
|
1059
|
+
"label": "You have been terminated"
|
1060
|
+
},
|
1061
|
+
{
|
1062
|
+
"_id": "best-arnold-quote_checkboxes_1_item_4",
|
1063
|
+
"hint": "",
|
1064
|
+
"name": "best-arnold-quote_checkboxes_1",
|
1065
|
+
"_type": "checkbox",
|
1066
|
+
"_uuid": "6b82b4e4-6dfd-4b3c-b6ed-2d71be0980bf",
|
1067
|
+
"label": "I am GROOT"
|
1068
|
+
},
|
1069
|
+
{
|
1070
|
+
"_id": "best-arnold-quote_checkboxes_1_item_5",
|
1071
|
+
"hint": "",
|
1072
|
+
"name": "best-arnold-quote_checkboxes_1",
|
1073
|
+
"_type": "checkbox",
|
1074
|
+
"_uuid": "8c2c6161-7309-4e4f-9f3c-9fa629bcb459",
|
1075
|
+
"label": "Dance Off, Bro."
|
1076
|
+
}
|
1077
|
+
],
|
1078
|
+
"legend": "Select all Arnold Schwarzenegger quotes",
|
1079
|
+
"validation": {
|
1080
|
+
"required": true
|
1081
|
+
}
|
1082
|
+
}
|
1083
|
+
]
|
1084
|
+
},
|
1085
|
+
{
|
1086
|
+
"_id": "page.arnold-right-answers",
|
1087
|
+
"url": "arnold-right-answers",
|
1088
|
+
"body": "You are right! Now, talk to the hand!",
|
1089
|
+
"lede": "",
|
1090
|
+
"_type": "page.content",
|
1091
|
+
"_uuid": "56e80942-d0a4-405a-85cd-bd1b100013d6",
|
1092
|
+
"heading": "You are right",
|
1093
|
+
"components": [
|
1094
|
+
{
|
1095
|
+
"_id": "arnold-right-answers_content_1",
|
1096
|
+
"name": "arnold-right-answers_content_1",
|
1097
|
+
"_type": "content",
|
1098
|
+
"_uuid": "9a7948f1-9e9a-4273-b52e-e2917c79f37c",
|
1099
|
+
"content": "You are right! Now, talk to the hand!"
|
1100
|
+
}
|
1101
|
+
],
|
1102
|
+
"section_heading": ""
|
1103
|
+
},
|
1104
|
+
{
|
1105
|
+
"_id": "page.arnold-wrong-answers",
|
1106
|
+
"url": "arnold-wrong-answers",
|
1107
|
+
"body": "You are wrong! These are from the Guardians of the Galaxy!",
|
1108
|
+
"lede": "",
|
1109
|
+
"_type": "page.content",
|
1110
|
+
"_uuid": "6324cca4-7770-4765-89b9-1cdc41f49c8b",
|
1111
|
+
"heading": "You are wrong",
|
1112
|
+
"components": [
|
1113
|
+
{
|
1114
|
+
"_id": "arnold-wrong-answers_content_1",
|
1115
|
+
"name": "arnold-wrong-answers_content_1",
|
1116
|
+
"_type": "content",
|
1117
|
+
"_uuid": "3bd3ca1d-fed7-43b0-ab90-b4425b634203",
|
1118
|
+
"content": "You need to master the ability of standing so incredibly still, that you become invisible to the eye."
|
1119
|
+
}
|
1120
|
+
],
|
1121
|
+
"section_heading": ""
|
1122
|
+
},
|
1123
|
+
{
|
1124
|
+
"_id": "page.arnold-incomplete-answers",
|
1125
|
+
"url": "arnold-incomplete-answers",
|
1126
|
+
"body": "You are wrong! The answers are incomplete.",
|
1127
|
+
"lede": "",
|
1128
|
+
"_type": "page.content",
|
1129
|
+
"_uuid": "941137d7-a1da-43fd-994a-98a4f9ea6d46",
|
1130
|
+
"heading": "You are wrong",
|
1131
|
+
"components": [
|
1132
|
+
{
|
1133
|
+
"_id": "arnold-incomplete-answers_content_1",
|
1134
|
+
"name": "arnold-incomplete-answers_content_1",
|
1135
|
+
"_type": "content",
|
1136
|
+
"_uuid": "16252a29-8e00-4247-b47f-3e94c863a540",
|
1137
|
+
"content": "The answers are incomplete. You need to remember Arnold saying 'I will be back'. So go back to answer correctly."
|
1138
|
+
}
|
1139
|
+
],
|
1140
|
+
"section_heading": ""
|
1141
|
+
},
|
940
1142
|
{
|
941
1143
|
"_id": "page.check-answers",
|
942
1144
|
"url": "check-answers",
|
@@ -0,0 +1,190 @@
|
|
1
|
+
{
|
2
|
+
"_id": "service.base",
|
3
|
+
"_type": "service.base",
|
4
|
+
"pages": [
|
5
|
+
{
|
6
|
+
"_id": "page.start",
|
7
|
+
"url": "/",
|
8
|
+
"body": "Use this service to:\r\n\r\n* do something\r\n* update your name, address or other details\r\n* do something else\r\n\r\nRegistering takes around 5 minutes.",
|
9
|
+
"lede": "",
|
10
|
+
"_type": "page.start",
|
11
|
+
"_uuid": "cf6dc32f-502c-4215-8c27-1151a45735bb",
|
12
|
+
"steps": [
|
13
|
+
"page.name",
|
14
|
+
"page.email-address",
|
15
|
+
"page.parent-name",
|
16
|
+
"page.check-answers",
|
17
|
+
"page.confirmation"
|
18
|
+
],
|
19
|
+
"heading": "Service name goes here",
|
20
|
+
"before_you_start": "###Before you start\r\nYou can also register by post.\r\n\r\nThe online service is also available in Welsh (Cymraeg).\r\n\r\nYou cannot register for this service if you’re in the UK illegally."
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"_id": "page.name",
|
24
|
+
"url": "name",
|
25
|
+
"body": "Body section",
|
26
|
+
"lede": "",
|
27
|
+
"_type": "page.singlequestion",
|
28
|
+
"_uuid": "9e1ba77f-f1e5-42f4-b090-437aa9af7f73",
|
29
|
+
"heading": "Question",
|
30
|
+
"components": [
|
31
|
+
{
|
32
|
+
"_id": "name_text_1",
|
33
|
+
"hint": "",
|
34
|
+
"name": "name_text_1",
|
35
|
+
"_type": "text",
|
36
|
+
"_uuid": "27d377a2-6828-44ca-87d1-b83ddac98284",
|
37
|
+
"label": "Full name",
|
38
|
+
"errors": {},
|
39
|
+
"collection": "components",
|
40
|
+
"validation": {
|
41
|
+
"required": true,
|
42
|
+
"max_length": 10,
|
43
|
+
"min_length": 2
|
44
|
+
}
|
45
|
+
}
|
46
|
+
]
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"_id": "page.email-address",
|
50
|
+
"url": "email-address",
|
51
|
+
"body": "Body section",
|
52
|
+
"lede": "",
|
53
|
+
"_type": "page.singlequestion",
|
54
|
+
"_uuid": "df1ba645-f748-46d0-ad75-f34112653e37",
|
55
|
+
"heading": "Question",
|
56
|
+
"components": [
|
57
|
+
{
|
58
|
+
"_id": "email-address_text_1",
|
59
|
+
"hint": "",
|
60
|
+
"name": "email-address_text_1",
|
61
|
+
"_type": "text",
|
62
|
+
"_uuid": "f27e5788-e784-4bfd-8b21-2fab8ce95abb",
|
63
|
+
"label": "Email address",
|
64
|
+
"errors": {
|
65
|
+
"format": {},
|
66
|
+
"required": {
|
67
|
+
"any": "Enter an email address"
|
68
|
+
},
|
69
|
+
"max_length": {
|
70
|
+
"any": "%{control} is too long."
|
71
|
+
},
|
72
|
+
"min_length": {
|
73
|
+
"any": "%{control} is too short."
|
74
|
+
}
|
75
|
+
},
|
76
|
+
"collection": "components",
|
77
|
+
"validation": {
|
78
|
+
"required": true,
|
79
|
+
"max_length": 30,
|
80
|
+
"min_length": 2
|
81
|
+
}
|
82
|
+
}
|
83
|
+
]
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"_id": "page.parent-name",
|
87
|
+
"url": "parent-name",
|
88
|
+
"body": "Body section",
|
89
|
+
"lede": "",
|
90
|
+
"_type": "page.singlequestion",
|
91
|
+
"_uuid": "4b8c6bf3-878a-4446-9198-48351b3e2185",
|
92
|
+
"heading": "Question",
|
93
|
+
"components": [
|
94
|
+
{
|
95
|
+
"_id": "parent-name_text_1",
|
96
|
+
"hint": "",
|
97
|
+
"name": "parent-name_text_1",
|
98
|
+
"_type": "text",
|
99
|
+
"_uuid": "5ad372fa-ed35-477f-b471-4d444f991210",
|
100
|
+
"label": "Parent name",
|
101
|
+
"errors": {},
|
102
|
+
"collection": "components",
|
103
|
+
"validation": {
|
104
|
+
"required": false,
|
105
|
+
"max_length": 10,
|
106
|
+
"min_length": 2
|
107
|
+
}
|
108
|
+
}
|
109
|
+
]
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"_id": "page.check-answers",
|
113
|
+
"url": "check-answers",
|
114
|
+
"_type": "page.checkanswers",
|
115
|
+
"_uuid": "e337070b-f636-49a3-a65c-f506675265f0",
|
116
|
+
"heading": "Check your answers",
|
117
|
+
"send_body": "By submitting this application you confirm that, to the best of your knowledge, the details you are providing are correct.",
|
118
|
+
"components": [
|
119
|
+
{
|
120
|
+
"_id": "check-answers_content_2",
|
121
|
+
"name": "check-answers_content_2",
|
122
|
+
"_type": "content",
|
123
|
+
"_uuid": "b065ff4f-90c5-4ba2-b4ac-c984a9dd2470",
|
124
|
+
"content": "Take the cannoli.",
|
125
|
+
"collection": "components"
|
126
|
+
}
|
127
|
+
],
|
128
|
+
"send_heading": "Now send your application",
|
129
|
+
"add_component": "content",
|
130
|
+
"extra_components": [
|
131
|
+
{
|
132
|
+
"_id": "check-answers_content_1",
|
133
|
+
"name": "check-answers_content_1",
|
134
|
+
"_type": "content",
|
135
|
+
"_uuid": "3e6ef27e-91a6-402f-8291-b7ce669e824e",
|
136
|
+
"content": "Check yourself before you wreck yourself.",
|
137
|
+
"collection": "extra_components"
|
138
|
+
}
|
139
|
+
],
|
140
|
+
"add_extra_component": "content"
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"_id": "page.confirmation",
|
144
|
+
"url": "confirmation",
|
145
|
+
"body": "Some day I will be the most powerful Jedi ever!",
|
146
|
+
"lede": "",
|
147
|
+
"_type": "page.confirmation",
|
148
|
+
"_uuid": "778e364b-9a7f-4829-8eb2-510e08f156a3",
|
149
|
+
"heading": "Complaint sent",
|
150
|
+
"components": []
|
151
|
+
}
|
152
|
+
],
|
153
|
+
"locale": "en",
|
154
|
+
"created_at": "2021-04-21T13:10:19Z",
|
155
|
+
"created_by": "099d5bf5-5f7b-444c-86ee-9e189cc1a369",
|
156
|
+
"service_id": "488edccd-8411-4ffb-a38b-6a96c6ac28d6",
|
157
|
+
"version_id": "27dc30c9-f7b8-4dec-973a-bd153f6797df",
|
158
|
+
"service_name": "Version Fixture",
|
159
|
+
"configuration": {
|
160
|
+
"meta": {
|
161
|
+
"_id": "config.meta",
|
162
|
+
"_type": "config.meta",
|
163
|
+
"items": [
|
164
|
+
{
|
165
|
+
"_id": "config.meta--link",
|
166
|
+
"href": "cookies",
|
167
|
+
"text": "Cookies",
|
168
|
+
"_type": "link"
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"_id": "config.meta--link--2",
|
172
|
+
"href": "privacy",
|
173
|
+
"text": "Privacy",
|
174
|
+
"_type": "link"
|
175
|
+
},
|
176
|
+
{
|
177
|
+
"_id": "config.meta--link--3",
|
178
|
+
"href": "accessibility",
|
179
|
+
"text": "Accessibility",
|
180
|
+
"_type": "link"
|
181
|
+
}
|
182
|
+
]
|
183
|
+
},
|
184
|
+
"service": {
|
185
|
+
"_id": "config.service",
|
186
|
+
"_type": "config.service"
|
187
|
+
}
|
188
|
+
},
|
189
|
+
"standalone_pages": []
|
190
|
+
}
|
@@ -45,17 +45,17 @@ module MetadataPresenter
|
|
45
45
|
|
46
46
|
def draw_nodes
|
47
47
|
flow.each do |id, _value|
|
48
|
-
flow_object = service.
|
48
|
+
flow_object = service.flow_object(id)
|
49
49
|
|
50
50
|
if flow_object.branch?
|
51
|
-
full_description = flow_object.conditions.map do |condition|
|
52
|
-
condition.criterias.map
|
51
|
+
full_description = flow_object.conditions.map.each_with_index do |condition, _index|
|
52
|
+
condition.criterias.map { |criteria|
|
53
53
|
criteria.service = service
|
54
54
|
|
55
|
-
"
|
56
|
-
|
55
|
+
"#{criteria.criteria_component.humanised_title} #{criteria.operator} #{criteria.field_label}"
|
56
|
+
}.join(" #{condition.condition_type} ")
|
57
57
|
end
|
58
|
-
nodes[id] = @graphviz.add_nodes(full_description.flatten.join('
|
58
|
+
nodes[id] = @graphviz.add_nodes(full_description.flatten.join(' / '))
|
59
59
|
else
|
60
60
|
current_page = find_page_by_uuid(id)
|
61
61
|
nodes[id] = @graphviz.add_nodes(current_page.url)
|
@@ -65,7 +65,7 @@ module MetadataPresenter
|
|
65
65
|
|
66
66
|
def draw_edges
|
67
67
|
flow.each do |id, _value|
|
68
|
-
flow_object = service.
|
68
|
+
flow_object = service.flow_object(id)
|
69
69
|
current_node = nodes[id]
|
70
70
|
node_next = nodes[flow_object.default_next]
|
71
71
|
|
@@ -83,7 +83,7 @@ module MetadataPresenter
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def flow
|
86
|
-
|
86
|
+
service.flow
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"$id": "http://gov.uk/schema/v1.0.0/flow/base",
|
3
|
+
"_name": "flow.base",
|
4
|
+
"title": "Base flow object",
|
5
|
+
"description": "Base flow object containing page or branch objects",
|
6
|
+
"type": "object",
|
7
|
+
"patternProperties": {
|
8
|
+
"type": "object",
|
9
|
+
"^S_": {
|
10
|
+
"type": "string"
|
11
|
+
},
|
12
|
+
"properties": {
|
13
|
+
"anyOf": [
|
14
|
+
{
|
15
|
+
"$ref": "flow.page"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"$ref": "flow.branch"
|
19
|
+
}
|
20
|
+
]
|
21
|
+
},
|
22
|
+
"additionalProperties": false
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
{
|
2
|
+
"$id": "http://gov.uk/schema/v1.0.0/flow/branch",
|
3
|
+
"_name": "flow.branch",
|
4
|
+
"title": "Flow branching object",
|
5
|
+
"description": "Flow object that represents a branching object",
|
6
|
+
"type": "object",
|
7
|
+
"properties": {
|
8
|
+
"_type": {
|
9
|
+
"type": "string",
|
10
|
+
"const": "flow.branch"
|
11
|
+
},
|
12
|
+
"next": {
|
13
|
+
"type": "object",
|
14
|
+
"properties": {
|
15
|
+
"default": {
|
16
|
+
"type": "string"
|
17
|
+
},
|
18
|
+
"conditions": {
|
19
|
+
"$ref": "#/definitions/conditions"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"additionalProperties": false,
|
25
|
+
"definitions": {
|
26
|
+
"conditions": {
|
27
|
+
"type": "array",
|
28
|
+
"items": {
|
29
|
+
"type": "object",
|
30
|
+
"properties": {
|
31
|
+
"condition_type": {
|
32
|
+
"type": "string",
|
33
|
+
"enum": [
|
34
|
+
"if",
|
35
|
+
"and",
|
36
|
+
"or"
|
37
|
+
]
|
38
|
+
},
|
39
|
+
"next": {
|
40
|
+
"type": "string"
|
41
|
+
},
|
42
|
+
"criterias": {
|
43
|
+
"$ref": "#/definitions/criterias"
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
},
|
48
|
+
"criterias": {
|
49
|
+
"type": "array",
|
50
|
+
"items": {
|
51
|
+
"type": "object",
|
52
|
+
"properties": {
|
53
|
+
"operator": {
|
54
|
+
"type": "string",
|
55
|
+
"enum": [
|
56
|
+
"is",
|
57
|
+
"is_not",
|
58
|
+
"is_answered",
|
59
|
+
"is_not_answered"
|
60
|
+
],
|
61
|
+
"page": {
|
62
|
+
"type": "string"
|
63
|
+
},
|
64
|
+
"component": {
|
65
|
+
"type": "string"
|
66
|
+
},
|
67
|
+
"field": {
|
68
|
+
"type": "string"
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"$id": "http://gov.uk/schema/v1.0.0/flow/page",
|
3
|
+
"_name": "flow.page",
|
4
|
+
"title": "Flow page object",
|
5
|
+
"description": "Flow object that represents a page",
|
6
|
+
"type": "object",
|
7
|
+
"properties": {
|
8
|
+
"_type": {
|
9
|
+
"type": "string",
|
10
|
+
"const": "flow.page"
|
11
|
+
},
|
12
|
+
"next": {
|
13
|
+
"type": "object",
|
14
|
+
"properties": {
|
15
|
+
"default": {
|
16
|
+
"type": "string"
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
},
|
21
|
+
"additionalProperties": false
|
22
|
+
}
|
data/schemas/service/base.json
CHANGED
@@ -32,6 +32,9 @@
|
|
32
32
|
"configuration": {
|
33
33
|
"$ref": "configuration"
|
34
34
|
},
|
35
|
+
"flow": {
|
36
|
+
"$ref": "flow.base"
|
37
|
+
},
|
35
38
|
"pages": {
|
36
39
|
"type": "array",
|
37
40
|
"items": {
|
@@ -77,6 +80,5 @@
|
|
77
80
|
"configuration",
|
78
81
|
"pages",
|
79
82
|
"standalone_pages"
|
80
|
-
]
|
81
|
-
"additionalProperties": false
|
83
|
+
]
|
82
84
|
}
|
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: 1.7.
|
4
|
+
version: 1.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MoJ Online
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|
@@ -358,6 +358,10 @@ files:
|
|
358
358
|
- default_metadata/config/service.json
|
359
359
|
- default_metadata/definition/checkbox.json
|
360
360
|
- default_metadata/definition/radio.json
|
361
|
+
- default_metadata/flow/branch.json
|
362
|
+
- default_metadata/flow/condition.json
|
363
|
+
- default_metadata/flow/criteria.json
|
364
|
+
- default_metadata/flow/page.json
|
361
365
|
- default_metadata/page/checkanswers.json
|
362
366
|
- default_metadata/page/confirmation.json
|
363
367
|
- default_metadata/page/content.json
|
@@ -378,6 +382,7 @@ files:
|
|
378
382
|
- fixtures/branching.json
|
379
383
|
- fixtures/invalid_content_page.json
|
380
384
|
- fixtures/no_component_page.json
|
385
|
+
- fixtures/no_flow_service.json
|
381
386
|
- fixtures/non_finished_service.json
|
382
387
|
- fixtures/service.json
|
383
388
|
- fixtures/version.json
|
@@ -433,6 +438,9 @@ files:
|
|
433
438
|
- schemas/definition/width_class.input.json
|
434
439
|
- schemas/definition/width_class.json
|
435
440
|
- schemas/errors/errors.json
|
441
|
+
- schemas/flow/base.json
|
442
|
+
- schemas/flow/branch.json
|
443
|
+
- schemas/flow/page.json
|
436
444
|
- schemas/link/link.json
|
437
445
|
- schemas/page/checkanswers.json
|
438
446
|
- schemas/page/confirmation.json
|