metadata_presenter 2.0.1 → 2.0.2

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: 984ce62e691c47847bd4bbc36332690f442bcf7db3a65520e79137c04b03b35a
4
- data.tar.gz: e028e1d6285c37403ba079089151d0187f8abc5adc25ec4033995b21b2dc54cc
3
+ metadata.gz: 4e13fd4a4a17bf97e91a2e69b59a5c12c3743e0cf38ce40a1c06b9b4b9915898
4
+ data.tar.gz: c35ff1dc9a73b802e01f4995a4224ac73077f1a2e00676e67e7a49095d29c6fb
5
5
  SHA512:
6
- metadata.gz: 9663825f4e18f2f465739f2c2fc72fafdbb9b1d9c91b990c7778054335ad577ea87ea6205a404e229d73ebaf3e4105e1c1c1afd11543832bc4b81c23430c8735
7
- data.tar.gz: 04e04bdc47ebd8aca8ae538d5ff9d32eeb2c1c00fc5569d7a5b88fa7343575b9cccbb57a12a8ed0acbdee9c3bc9f5a63aee97a1a7bc51c996c782aeee4eea0f7
6
+ metadata.gz: 9d456b26ddc24e8e39e586eec91f7bc4acfd2c67506bc59d70fc1fdda8e8e0846dfc27fb965b9cd67653d6cca60ef7262a691cc4e8399486db0626b157f9b789
7
+ data.tar.gz: 073523ef858cf90830133c5c8f2cdc3a230b6d79c8b9794c2d156892cfbfbc8a8208f744937aa63f55cefa70d5846a533f4fa492dfbee35b8f2fa06122adbf46
@@ -8,10 +8,8 @@ module MetadataPresenter
8
8
 
9
9
  if conditionals?
10
10
  evaluate_conditionals
11
- elsif current_page_flow.present?
12
- service.find_page_by_uuid(current_page_flow.default_next)
13
11
  else
14
- service.next_page(from: current_page_url)
12
+ service.find_page_by_uuid(current_page_flow.default_next)
15
13
  end
16
14
  end
17
15
 
@@ -4,16 +4,11 @@ module MetadataPresenter
4
4
  attr_accessor :service, :user_data, :current_page, :referrer
5
5
 
6
6
  def page
7
- # what happens when a user enters in the middle of the flow
8
7
  return if no_current_or_referrer_pages? || service.no_back_link?(current_page)
9
8
 
10
- if service.flow.present?
11
- return referrer_page if return_to_referrer?
9
+ return referrer_page if return_to_referrer?
12
10
 
13
- TraversedPages.new(service, user_data, current_page).last
14
- else
15
- service.previous_page(current_page: current_page, referrer: referrer)
16
- end
11
+ TraversedPages.new(service, user_data, current_page).last
17
12
  end
18
13
 
19
14
  private
@@ -23,6 +18,8 @@ module MetadataPresenter
23
18
  end
24
19
 
25
20
  def return_to_referrer?
21
+ return false unless current_page.standalone?
22
+
26
23
  current_page.standalone? ||
27
24
  (referrer_page && referrer_page.standalone?)
28
25
  end
@@ -12,8 +12,6 @@ module MetadataPresenter
12
12
  delegate :last, to: :all
13
13
 
14
14
  def all
15
- return latest_pages if service.flow.blank?
16
-
17
15
  page_uuid = service.start_page.uuid
18
16
 
19
17
  service.flow.size.times do
@@ -33,6 +33,20 @@
33
33
  ]
34
34
  }
35
35
  },
36
+ "flow": {
37
+ "9626b2e9-5ef0-4070-8331-ac55151b22c4": {
38
+ "_type": "flow.page",
39
+ "next": {
40
+ "default": "1ed3e4ad-5098-41c9-b4b6-426e89f7804e"
41
+ }
42
+ },
43
+ "1ed3e4ad-5098-41c9-b4b6-426e89f7804e": {
44
+ "_type": "flow.page",
45
+ "next": {
46
+ "default": ""
47
+ }
48
+ }
49
+ },
36
50
  "pages": [
37
51
  {
38
52
  "_uuid": "9626b2e9-5ef0-4070-8331-ac55151b22c4",
@@ -42,7 +56,6 @@
42
56
  "lede": "Use this service to:",
43
57
  "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.",
44
58
  "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.",
45
- "steps": [],
46
59
  "url": "/"
47
60
  },
48
61
  {
@@ -33,6 +33,20 @@
33
33
  ]
34
34
  }
35
35
  },
36
+ "flow": {
37
+ "9626b2e9-5ef0-4070-8331-ac55151b22c4": {
38
+ "_type": "flow.page",
39
+ "next": {
40
+ "default": "1ed3e4ad-5098-41c9-b4b6-426e89f7804e"
41
+ }
42
+ },
43
+ "b238a22f-c180-48d0-a7d9-8aad2036f1f2": {
44
+ "_type": "flow.page",
45
+ "next": {
46
+ "default": ""
47
+ }
48
+ }
49
+ },
36
50
  "pages": [
37
51
  {
38
52
  "_uuid": "9626b2e9-5ef0-4070-8331-ac55151b22c4",
@@ -42,7 +56,6 @@
42
56
  "lede": "Use this service to:",
43
57
  "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.",
44
58
  "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.",
45
- "steps": [],
46
59
  "url": "/"
47
60
  },
48
61
  {
@@ -34,23 +34,46 @@
34
34
  ]
35
35
  }
36
36
  },
37
+ "flow": {
38
+ "cf6dc32f-502c-4215-8c27-1151a45735bb": {
39
+ "_type": "flow.page",
40
+ "next": {
41
+ "default": "9e1ba77f-f1e5-42f4-b090-437aa9af7f73"
42
+ }
43
+ },
44
+ "9e1ba77f-f1e5-42f4-b090-437aa9af7f73": {
45
+ "_type": "flow.page",
46
+ "next": {
47
+ "default": "68fbb180-9a2a-48f6-9da6-545e28b8d35a"
48
+ }
49
+ },
50
+ "68fbb180-9a2a-48f6-9da6-545e28b8d35a": {
51
+ "_type": "flow.page",
52
+ "next": {
53
+ "default": "09e91fd9-7a46-4840-adbc-244d545cfef7"
54
+ }
55
+ },
56
+ "09e91fd9-7a46-4840-adbc-244d545cfef7": {
57
+ "_type": "flow.page",
58
+ "next": {
59
+ "default": ""
60
+ }
61
+ }
62
+ },
37
63
  "pages": [
38
64
  {
39
65
  "_id": "page.start",
40
66
  "_type": "page.start",
67
+ "_uuid": "cf6dc32f-502c-4215-8c27-1151a45735bb",
41
68
  "heading": "Service name goes here",
42
69
  "lede": "This is your start page first paragraph. You can only have one paragraph here.",
43
70
  "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.",
44
- "steps": [
45
- "page.name",
46
- "page.email-address",
47
- "page.parent_name"
48
- ],
49
71
  "url": "/"
50
72
  },
51
73
  {
52
74
  "_id": "page.name",
53
75
  "_type": "page.singlequestion",
76
+ "_uuid": "9e1ba77f-f1e5-42f4-b090-437aa9af7f73",
54
77
  "components": [
55
78
  {
56
79
  "_id": "page.name--text.auto_name__1",
@@ -70,6 +93,7 @@
70
93
  {
71
94
  "_id": "page.email-address",
72
95
  "_type": "page.singlequestion",
96
+ "_uuid": "68fbb180-9a2a-48f6-9da6-545e28b8d35a",
73
97
  "heading": "Email address",
74
98
  "components": [
75
99
  {
@@ -101,6 +125,7 @@
101
125
  {
102
126
  "_id": "page.parent_name",
103
127
  "_type": "page.singlequestion",
128
+ "_uuid": "09e91fd9-7a46-4840-adbc-244d545cfef7",
104
129
  "components": [
105
130
  {
106
131
  "_id": "page.parent-name--text.auto_name__3",
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "_id": "service.base",
3
3
  "_type": "service.base",
4
+ "flow": {
5
+ "86ed04ac-1727-4172-8dd2-608009f1a656": {
6
+ "_type": "flow.page",
7
+ "next": {
8
+ "default": ""
9
+ }
10
+ }
11
+ },
4
12
  "pages": [
5
13
  {
6
14
  "_id": "page.start",
@@ -9,7 +17,6 @@
9
17
  "lede": "",
10
18
  "_type": "page.start",
11
19
  "_uuid": "86ed04ac-1727-4172-8dd2-608009f1a656",
12
- "steps": [],
13
20
  "heading": "Service name goes here",
14
21
  "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."
15
22
  }
@@ -1,6 +1,92 @@
1
1
  {
2
2
  "_id": "service.base",
3
3
  "_type": "service.base",
4
+ "flow": {
5
+ "cf6dc32f-502c-4215-8c27-1151a45735bb": {
6
+ "_type": "flow.page",
7
+ "next": {
8
+ "default": "9e1ba77f-f1e5-42f4-b090-437aa9af7f73"
9
+ }
10
+ },
11
+ "9e1ba77f-f1e5-42f4-b090-437aa9af7f73": {
12
+ "_type": "flow.page",
13
+ "next": {
14
+ "default": "df1ba645-f748-46d0-ad75-f34112653e37"
15
+ }
16
+ },
17
+ "df1ba645-f748-46d0-ad75-f34112653e37": {
18
+ "_type": "flow.page",
19
+ "next": {
20
+ "default": "4b8c6bf3-878a-4446-9198-48351b3e2185"
21
+ }
22
+ },
23
+ "4b8c6bf3-878a-4446-9198-48351b3e2185": {
24
+ "_type": "flow.page",
25
+ "next": {
26
+ "default": "54ccc6cd-60c0-4749-947b-a97af1bc0aa2"
27
+ }
28
+ },
29
+ "54ccc6cd-60c0-4749-947b-a97af1bc0aa2": {
30
+ "_type": "flow.page",
31
+ "next": {
32
+ "default": "b8335af2-6642-4e2f-8192-0dd12279eec7"
33
+ }
34
+ },
35
+ "b8335af2-6642-4e2f-8192-0dd12279eec7": {
36
+ "_type": "flow.page",
37
+ "next": {
38
+ "default": "68fbb180-9a2a-48f6-9da6-545e28b8d35a"
39
+ }
40
+ },
41
+ "68fbb180-9a2a-48f6-9da6-545e28b8d35a": {
42
+ "_type": "flow.page",
43
+ "next": {
44
+ "default": "7806cd64-0c05-450e-ba6f-2325c8b22d46"
45
+ }
46
+ },
47
+ "7806cd64-0c05-450e-ba6f-2325c8b22d46": {
48
+ "_type": "flow.page",
49
+ "next": {
50
+ "default": "0c022e95-0748-4dda-8ba5-12fd1d2f596b"
51
+ }
52
+ },
53
+ "0c022e95-0748-4dda-8ba5-12fd1d2f596b": {
54
+ "_type": "flow.page",
55
+ "next": {
56
+ "default": "e8708909-922e-4eaf-87a5-096f7a713fcb"
57
+ }
58
+ },
59
+ "e8708909-922e-4eaf-87a5-096f7a713fcb": {
60
+ "_type": "flow.page",
61
+ "next": {
62
+ "default": "80420693-d6f2-4fce-a860-777ca774a6f5"
63
+ }
64
+ },
65
+ "80420693-d6f2-4fce-a860-777ca774a6f5": {
66
+ "_type": "flow.page",
67
+ "next": {
68
+ "default": "2ef7d11e-0307-49e9-9fe2-345dc528dd66"
69
+ }
70
+ },
71
+ "2ef7d11e-0307-49e9-9fe2-345dc528dd66": {
72
+ "_type": "flow.page",
73
+ "next": {
74
+ "default": "e337070b-f636-49a3-a65c-f506675265f0"
75
+ }
76
+ },
77
+ "e337070b-f636-49a3-a65c-f506675265f0": {
78
+ "_type": "flow.page",
79
+ "next": {
80
+ "default": "778e364b-9a7f-4829-8eb2-510e08f156a3"
81
+ }
82
+ },
83
+ "778e364b-9a7f-4829-8eb2-510e08f156a3": {
84
+ "_type": "flow.page",
85
+ "next": {
86
+ "default": ""
87
+ }
88
+ }
89
+ },
4
90
  "pages": [
5
91
  {
6
92
  "_id": "page.start",
@@ -9,21 +95,6 @@
9
95
  "lede": "",
10
96
  "_type": "page.start",
11
97
  "_uuid": "cf6dc32f-502c-4215-8c27-1151a45735bb",
12
- "steps": [
13
- "page.name",
14
- "page.email-address",
15
- "page.parent-name",
16
- "page.your-age",
17
- "page.family-hobbies",
18
- "page.do-you-like-star-wars",
19
- "page.holiday",
20
- "page.burgers",
21
- "page.star-wars-knowledge",
22
- "page.how-many-lights",
23
- "page.dog-picture",
24
- "page.check-answers",
25
- "page.confirmation"
26
- ],
27
98
  "heading": "Service name goes here",
28
99
  "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."
29
100
  },
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '2.0.1'.freeze
2
+ VERSION = '2.0.2'.freeze
3
3
  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.0.1
4
+ version: 2.0.2
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-23 00:00:00.000000000 Z
11
+ date: 2021-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_design_system_formbuilder
@@ -382,12 +382,9 @@ files:
382
382
  - fixtures/branching.json
383
383
  - fixtures/invalid_content_page.json
384
384
  - fixtures/no_component_page.json
385
- - fixtures/no_flow_service.json
386
385
  - fixtures/non_finished_service.json
387
386
  - fixtures/service.json
388
- - fixtures/service_with_flow.json
389
387
  - fixtures/version.json
390
- - fixtures/version_with_flow.json
391
388
  - lib/metadata_presenter.rb
392
389
  - lib/metadata_presenter/engine.rb
393
390
  - lib/metadata_presenter/test_helpers.rb
@@ -1,190 +0,0 @@
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": "No Flow Service 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
- }