metadata_presenter 1.7.2 → 1.8.1
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/pages_controller.rb +5 -1
- 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.rb +0 -1
- 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 +10 -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/default_metadata/page/start.json +0 -1
- data/default_metadata/service/base.json +1 -0
- data/fixtures/branching.json +30 -37
- data/fixtures/no_flow_service.json +190 -0
- data/fixtures/service_with_flow.json +86 -0
- data/fixtures/version_with_flow.json +679 -0
- data/lib/metadata_presenter/version.rb +1 -1
- data/lib/tasks/metadata_presenter_tasks.rake +3 -3
- data/schemas/definition/page.form.json +0 -34
- data/schemas/flow/base.json +24 -0
- data/schemas/flow/branch.json +75 -0
- data/schemas/flow/page.json +22 -0
- data/schemas/page/start.json +1 -5
- data/schemas/service/base.json +4 -2
- metadata +12 -2
@@ -45,7 +45,7 @@ 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
51
|
full_description = flow_object.conditions.map.each_with_index do |condition, _index|
|
@@ -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
|
@@ -44,40 +44,6 @@
|
|
44
44
|
"content"
|
45
45
|
]
|
46
46
|
},
|
47
|
-
"steps_heading": {
|
48
|
-
"title": "Steps heading",
|
49
|
-
"description": "Name of section to use on step pages (if any)",
|
50
|
-
"type": "string",
|
51
|
-
"category": [
|
52
|
-
"content"
|
53
|
-
]
|
54
|
-
},
|
55
|
-
"steps": {
|
56
|
-
"title": "Steps",
|
57
|
-
"description": "The ‘child’ pages that follow from this ‘parent’ page",
|
58
|
-
"type": "array",
|
59
|
-
"items": {
|
60
|
-
"type": "string"
|
61
|
-
}
|
62
|
-
},
|
63
|
-
"enable_steps": {
|
64
|
-
"title": "Enable steps",
|
65
|
-
"description": "Allow current page to have steps",
|
66
|
-
"type": "boolean"
|
67
|
-
},
|
68
|
-
"show_steps": {
|
69
|
-
"title": "Steps visibility",
|
70
|
-
"category": [
|
71
|
-
"logic"
|
72
|
-
],
|
73
|
-
"description": "Whether to show or hide the page’s steps",
|
74
|
-
"oneOf": [
|
75
|
-
{
|
76
|
-
"$ref": "definition.conditional.boolean"
|
77
|
-
}
|
78
|
-
],
|
79
|
-
"default": true
|
80
|
-
},
|
81
47
|
"nextPage": {
|
82
48
|
"$ref": "definition.next_page"
|
83
49
|
}
|
@@ -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/page/start.json
CHANGED
@@ -15,9 +15,6 @@
|
|
15
15
|
"title": "Before you start",
|
16
16
|
"description": "A body of text that goes after the Start button"
|
17
17
|
},
|
18
|
-
"enable_steps": {
|
19
|
-
"const": true
|
20
|
-
},
|
21
18
|
"components": {
|
22
19
|
"accepts": [
|
23
20
|
"content"
|
@@ -37,7 +34,6 @@
|
|
37
34
|
]
|
38
35
|
},
|
39
36
|
"required": [
|
40
|
-
"heading"
|
41
|
-
"steps"
|
37
|
+
"heading"
|
42
38
|
]
|
43
39
|
}
|
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.
|
4
|
+
version: 1.8.1
|
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-09 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,9 +382,12 @@ 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
|
388
|
+
- fixtures/service_with_flow.json
|
383
389
|
- fixtures/version.json
|
390
|
+
- fixtures/version_with_flow.json
|
384
391
|
- lib/metadata_presenter.rb
|
385
392
|
- lib/metadata_presenter/engine.rb
|
386
393
|
- lib/metadata_presenter/test_helpers.rb
|
@@ -433,6 +440,9 @@ files:
|
|
433
440
|
- schemas/definition/width_class.input.json
|
434
441
|
- schemas/definition/width_class.json
|
435
442
|
- schemas/errors/errors.json
|
443
|
+
- schemas/flow/base.json
|
444
|
+
- schemas/flow/branch.json
|
445
|
+
- schemas/flow/page.json
|
436
446
|
- schemas/link/link.json
|
437
447
|
- schemas/page/checkanswers.json
|
438
448
|
- schemas/page/confirmation.json
|