metadata_presenter 1.7.2 → 1.7.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ac5fd51e02d3200c324282f394e5d8d3b11e0e440592e627290dfd7b6c767ba
4
- data.tar.gz: bced641e349533c820815867b08bfca21f7d8c0bbd619ed19615e424edcaa2a6
3
+ metadata.gz: cf6c41a569262e3d405b1611d563f30f4e0c5a13134c920349a24a1c2f3365e1
4
+ data.tar.gz: ac8d4ea6aa1aa1aca3c942ad098ee35b4f680668de3e53b087efc3ae10bb2c1d
5
5
  SHA512:
6
- metadata.gz: d38891660bc18dfe3472b43b84efc4a4752be370ba88decb17aad07aa47d779282214602bd52b10db043ad9aec8cc582e2010828deb8916f4b4b40fe069165d7
7
- data.tar.gz: 289b34c930dd5c2322d6c32bb22d761c2d2f973e8ae8be7edd5104d3af2f429055ac5edbe76a56b9e78b63e48da5958e551f3e1b66a444eaa02572a41ee3febf
6
+ metadata.gz: 07f84b9e3fa53d81c7acbc2b108926581d0be3d2ec8d6123afbdc63fdffdef32b1e4c8104a276c454735639c3f580764efbb482ac68347362a640d6406e7c65a
7
+ data.tar.gz: 29f2f870b2b832bec55069adf227d6de566deb80341d96987f8cd7ef108414db31ed21bde0b4d076f2593ace47498af2d4c4b2f815941ceb1c46f3197a235955
@@ -49,11 +49,11 @@ module MetadataPresenter
49
49
  end
50
50
 
51
51
  def current_page_flow
52
- service.flow(current_page_uuid)
52
+ service.flow_object(current_page_uuid)
53
53
  end
54
54
 
55
55
  def next_flow
56
- service.flow(current_page_flow.default_next)
56
+ service.flow_object(current_page_flow.default_next)
57
57
  end
58
58
 
59
59
  def next_flow_branch_object?
@@ -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 flow(page_uuid)
9
- MetadataPresenter::Flow.new(metadata.flow[page_uuid])
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.metadata['flow'].size.times do
17
+ service.flow.size.times do
18
18
  break if page_uuid == current_page.uuid
19
19
 
20
- flow_object = service.flow(page_uuid)
20
+ flow_object = service.flow_object(page_uuid)
21
21
 
22
22
  if flow_object.branch?
23
23
  page = EvaluateConditions.new(
@@ -0,0 +1,189 @@
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
+ }
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '1.7.2'.freeze
2
+ VERSION = '1.7.3'.freeze
3
3
  end
@@ -45,7 +45,7 @@ module MetadataPresenter
45
45
 
46
46
  def draw_nodes
47
47
  flow.each do |id, _value|
48
- flow_object = service.flow(id)
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.flow(id)
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
- metadata['flow']
86
+ service.flow
87
87
  end
88
88
  end
89
89
  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: 1.7.2
4
+ version: 1.7.3
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-07 00:00:00.000000000 Z
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
@@ -378,6 +378,7 @@ files:
378
378
  - fixtures/branching.json
379
379
  - fixtures/invalid_content_page.json
380
380
  - fixtures/no_component_page.json
381
+ - fixtures/no_flow_service.json
381
382
  - fixtures/non_finished_service.json
382
383
  - fixtures/service.json
383
384
  - fixtures/version.json