metadata_presenter 0.1.3 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f79e91606c7c59673a86669d122dc416167cacc1c3455b31767b0e5f4e2d286
4
- data.tar.gz: 0203707a252c31f29b1f4e68fb1355986af11988f32b053b2d7938440807f9b3
3
+ metadata.gz: bc59d58800c23dd0836423c3d0f02b76516db564afd6343d989291f23cddce3b
4
+ data.tar.gz: '078b3a6ab2888fb5a1f6f6ba8f925af66713469787af6991df362e1c19fcf245'
5
5
  SHA512:
6
- metadata.gz: 8ecfa6692526cf69e58a9b3f1762793d55f94a85c77c1a2289462da1ce30f45c8713bcb82de1f8125e203a21d68c6f4b20884ed0c7a795ab014ed522b64200d2
7
- data.tar.gz: d56dbb21959134416f939556f95d0f9f8c3b47ff9304c7a2895220bf94b3a406d0e136e39330bc8d39c01cc200fc2f047f5c9b80d6e17c2c8f7decb46af96511
6
+ metadata.gz: cdee22833e4d58cad16595fcd5b664be8b28641a4c0aeed6b7f5cb19f06a481330bfbb53a429442d8a72faf70a4dec97bffbdea0f368774d472377690635fdde
7
+ data.tar.gz: 7afb80b5201bdf97117c79bb604eba016207b4ec2caf7bad7ebf64a6426fdb51b2ccf4211bda81c8de0e33bd43d50dea6369a84cecf3987632191e6913037f4b
@@ -6,8 +6,7 @@ class MetadataPresenter::ValidateSchema
6
6
  def before(controller)
7
7
  return unless controller.request.post?
8
8
 
9
- schema_name = "request.#{controller.request.params['controller']}"
10
- validate(controller.request.params, schema_name)
9
+ validate(controller.request.params, 'request.service')
11
10
  rescue JSON::Schema::ValidationError, JSON::Schema::SchemaError, SchemaNotFoundError => e
12
11
  controller.render(
13
12
  json: ErrorsSerializer.new(message: e.message).attributes,
@@ -33,6 +33,12 @@
33
33
  </svg>
34
34
  </button>
35
35
  <% end %>
36
+
37
+ <% if @page.before_you_start %>
38
+ <p class="govuk-body-l" data-block-id="<%= @page.id %>" data-block-property="before-you-start">
39
+ <%= to_markdown(@page.before_you_start) %>
40
+ </p>
41
+ <%- end %>
36
42
  </div>
37
43
  </div>
38
44
  </div>
@@ -38,9 +38,10 @@
38
38
  <%= @user_data[component.name] %>
39
39
  </dd>
40
40
  <dd class="govuk-summary-list__actions">
41
- <%= link_to(change_answer_path(url: page.url),
42
- class: 'govuk-link',
43
- method: :post) do %>
41
+ <%= link_to(
42
+ change_answer_path(url: page.url),
43
+ class: 'govuk-link'
44
+ ) do %>
44
45
  Change<span class="govuk-visually-hidden"> Your answer for <%= component.label %></span>
45
46
  <% end %>
46
47
  </a>
@@ -3,6 +3,6 @@ MetadataPresenter::Engine.routes.draw do
3
3
 
4
4
  post '/reserved/:page_url/answers', to: 'answers#create', as: :reserved_answers
5
5
  post '/reserved/submissions', to: 'submissions#create', as: :reserved_submissions
6
- post '/reserved/change-answer', to: 'change_answer#create', as: :change_answer
6
+ get '/reserved/change-answer', to: 'change_answer#create', as: :change_answer
7
7
  match '*path', to: 'pages#show', via: :all
8
8
  end
@@ -0,0 +1,8 @@
1
+ {
2
+ "_id": "component.text",
3
+ "_type": "text",
4
+ "errors": {},
5
+ "hint": "Component hint",
6
+ "label": "Component label",
7
+ "name": "component-name"
8
+ }
@@ -1,7 +1,4 @@
1
1
  {
2
2
  "_id": "config.service",
3
- "_type": "config.service",
4
- "homepage_url": "https://www.gov.uk",
5
- "service_email_address": "moj-online@digital.justice.gov.uk",
6
- "service_url": "page.start"
3
+ "_type": "config.service"
7
4
  }
@@ -1,4 +1,5 @@
1
1
  {
2
2
  "_id": "page.confirmation",
3
+ "_type": "page.confirmation",
3
4
  "heading": "Required - Confirmation"
4
5
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_id": "page.singlequestion",
3
+ "_type": "page.singlequestion",
4
+ "heading": "Question",
5
+ "lede": "This is the lede",
6
+ "body": "Body section",
7
+ "components": [],
8
+ "url": ""
9
+ }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "_id": "page.summary",
3
+ "_type": "page.summary",
3
4
  "heading": "Check your answers",
4
5
  "send_heading": "Now send your application",
5
6
  "send_body": "By submitting this application you confirm that, to the best of your knowledge, the details you are providing are correct."
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "_id": "service.base",
3
3
  "_type": "service.base",
4
- "service_name": "Service name goes here",
4
+ "service_name": "Service name",
5
5
  "configuration": {},
6
6
  "pages": [
7
7
  {
8
8
  "_id": "page.start",
9
9
  "_type": "page.start",
10
- "heading": "Start page heading",
11
- "body": "Start page body text",
12
- "lede": "Start page lede text",
10
+ "heading": "Service name goes here",
11
+ "lede": "This is your start page first paragraph. You can only have one paragraph here.",
12
+ "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.",
13
+ "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.",
13
14
  "steps": [],
14
15
  "url": "/"
15
16
  }
@@ -2,15 +2,12 @@
2
2
  "_id": "service.base",
3
3
  "_type": "service.base",
4
4
  "service_id": "d243f5c0-e8a2-4b13-982c-7b5f3fa128cf",
5
- "service_name": "Main fixture to test Form builder",
5
+ "service_name": "Service name",
6
6
  "created_by": "4634ec01-5618-45ec-a4e2-bb5aa587e751",
7
7
  "configuration": {
8
8
  "service": {
9
9
  "_id": "config.service",
10
- "_type": "config.service",
11
- "homepage_url": "https://www.gov.uk",
12
- "service_email_address": "moj-online@digital.justice.gov.uk",
13
- "service_url": "page.start"
10
+ "_type": "config.service"
14
11
  },
15
12
  "meta": {
16
13
  "_id": "config.meta",
@@ -41,9 +38,9 @@
41
38
  {
42
39
  "_id": "page.start",
43
40
  "_type": "page.start",
44
- "body": "You cannot use this form to complain about:\r\n\r\n* the result of a case\r\n* a judge, magistrate, coroner or member of a tribunal\r\n\r\nThis online form is also available in [Welsh (Cymraeg)](https://complain-about-a-court-or-tribunal.form.service.justice.gov.uk/cy).",
45
- "heading": "Complain about a court or tribunal",
46
- "lede": "Your complaint will not affect your case.",
41
+ "heading": "Service name goes here",
42
+ "lede": "This is your start page first paragraph. You can only have one paragraph here.",
43
+ "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.",
47
44
  "steps": [
48
45
  "page.name",
49
46
  "page.email-address",
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "_id": "service.base",
3
3
  "_type": "service.base",
4
- "service_name": "Complain about a court or tribunal",
4
+ "service_name": "Service name",
5
5
  "created_by": "4634ec01-5618-45ec-a4e2-bb5aa587e751",
6
6
  "configuration": {
7
7
  "service": {
8
8
  "_id": "config.service",
9
- "_type": "config.service",
10
- "homepage_url": "https://www.gov.uk",
11
- "service_email_address": "moj-online@digital.justice.gov.uk",
12
- "service_url": "page.start"
9
+ "_type": "config.service"
13
10
  },
14
11
  "meta": {
15
12
  "_id": "config.meta",
@@ -40,9 +37,10 @@
40
37
  {
41
38
  "_id": "page.start",
42
39
  "_type": "page.start",
43
- "body": "You cannot use this form to complain about:\r\n\r\n* the result of a case\r\n* a judge, magistrate, coroner or member of a tribunal\r\n\r\nThis online form is also available in [Welsh (Cymraeg)](https://complain-about-a-court-or-tribunal.form.service.justice.gov.uk/cy).",
44
- "heading": "Complain about a court or tribunal",
45
- "lede": "Your complaint will not affect your case.",
40
+ "heading": "Service name goes here",
41
+ "lede": "Use this service to:",
42
+ "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.",
43
+ "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.",
46
44
  "steps": [],
47
45
  "url": "/"
48
46
  }
@@ -2,15 +2,12 @@
2
2
  "_id": "service.base",
3
3
  "_type": "service.base",
4
4
  "service_id": "d243f5c0-e8a2-4b13-982c-7b5f3fa128cf",
5
- "service_name": "Main fixture to test Form builder",
5
+ "service_name": "Service name",
6
6
  "created_by": "4634ec01-5618-45ec-a4e2-bb5aa587e751",
7
7
  "configuration": {
8
8
  "service": {
9
9
  "_id": "config.service",
10
- "_type": "config.service",
11
- "homepage_url": "https://www.gov.uk",
12
- "service_email_address": "moj-online@digital.justice.gov.uk",
13
- "service_url": "page.start"
10
+ "_type": "config.service"
14
11
  },
15
12
  "meta": {
16
13
  "_id": "config.meta",
@@ -41,9 +38,10 @@
41
38
  {
42
39
  "_id": "page.start",
43
40
  "_type": "page.start",
44
- "body": "You cannot use this form to complain about:\r\n\r\n* the result of a case\r\n* a judge, magistrate, coroner or member of a tribunal\r\n\r\nThis online form is also available in [Welsh (Cymraeg)](https://complain-about-a-court-or-tribunal.form.service.justice.gov.uk/cy).",
45
- "heading": "Complain about a court or tribunal",
46
- "lede": "Your complaint will not affect your case.",
41
+ "heading": "Service name goes here",
42
+ "lede": "This is your start page first paragraph. You can only have one paragraph here.",
43
+ "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
+ "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.",
47
45
  "steps": [
48
46
  "page.name",
49
47
  "page.email-address",
@@ -0,0 +1,21 @@
1
+ module MetadataPresenter
2
+ module TestHelpers
3
+ def service
4
+ MetadataPresenter::Service.new(service_metadata)
5
+ end
6
+
7
+ def fixtures_directory
8
+ @_fixtures_directory ||=
9
+ Pathname.new(MetadataPresenter::Engine.root.join('fixtures'))
10
+ end
11
+
12
+ def service_metadata
13
+ metadata_fixture(:version)
14
+ JSON.parse(File.read(fixtures_directory.join('version.json')))
15
+ end
16
+
17
+ def metadata_fixture(fixture_name)
18
+ JSON.parse(File.read(fixtures_directory.join("#{fixture_name}.json")))
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.8'
3
3
  end
@@ -5,9 +5,16 @@
5
5
  "description": "Let users start using a service",
6
6
  "type": "object",
7
7
  "properties": {
8
+ "_id": {
9
+ "const": "page.start"
10
+ },
8
11
  "_type": {
9
12
  "const": "page.start"
10
13
  },
14
+ "before_you_start": {
15
+ "title": "Before you start",
16
+ "description": "A body of text that goes after the Start button"
17
+ },
11
18
  "enable_steps": {
12
19
  "const": true
13
20
  },
@@ -25,10 +32,14 @@
25
32
  "ui_category": {
26
33
  "main": [
27
34
  "lede",
28
- "body"
35
+ "body",
36
+ "before_you_start"
29
37
  ]
30
38
  },
31
39
  "required": [
40
+ "_id",
41
+ "_type",
42
+ "heading",
32
43
  "steps"
33
44
  ]
34
45
  }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/request/service",
3
+ "_name": "request.service",
4
+ "title": "Create new service",
5
+ "description": "Request object schema for creating and updating a new service",
6
+ "type": "object",
7
+ "properties": {
8
+ "metadata": {
9
+ "$ref": "service.base"
10
+ }
11
+ },
12
+ "required": ["metadata"]
13
+ }
@@ -42,7 +42,6 @@
42
42
  "required": [
43
43
  "_id",
44
44
  "_type",
45
- "service_id",
46
45
  "service_name",
47
46
  "created_by",
48
47
  "locale",
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: 0.1.3
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - MoJ Online
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-30 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -255,9 +255,11 @@ files:
255
255
  - config/initializers/default_metadata.rb
256
256
  - config/initializers/schemas.rb
257
257
  - config/routes.rb
258
+ - default_metadata/component/text.json
258
259
  - default_metadata/config/meta.json
259
260
  - default_metadata/config/service.json
260
261
  - default_metadata/page/confirmation.json
262
+ - default_metadata/page/singlequestion.json
261
263
  - default_metadata/page/summary.json
262
264
  - default_metadata/service/base.json
263
265
  - default_metadata/string/error.max_length.json
@@ -268,6 +270,7 @@ files:
268
270
  - fixtures/version.json
269
271
  - lib/metadata_presenter.rb
270
272
  - lib/metadata_presenter/engine.rb
273
+ - lib/metadata_presenter/test_helpers.rb
271
274
  - lib/metadata_presenter/version.rb
272
275
  - lib/tasks/metadata_presenter_tasks.rake
273
276
  - schemas/condition/condition.json
@@ -308,8 +311,7 @@ files:
308
311
  - schemas/page/confirmation.json
309
312
  - schemas/page/start.json
310
313
  - schemas/page/summary.json
311
- - schemas/request/services.json
312
- - schemas/request/versions.json
314
+ - schemas/request/service.json
313
315
  - schemas/service/base.json
314
316
  - schemas/service/configuration.json
315
317
  - schemas/service/locale.json
@@ -1,48 +0,0 @@
1
- {
2
- "$id": "http://gov.uk/schema/v1.0.0/request/services",
3
- "_name": "request.services",
4
- "title": "Create new service",
5
- "description": "Request schema for creating a new service",
6
- "type": "object",
7
- "properties": {
8
- "metadata": {
9
- "type": "object",
10
- "properties": {
11
- "_id": {
12
- "const": "service.base"
13
- },
14
- "_type": {
15
- "const": "service.base"
16
- },
17
- "service_name": {
18
- "type": "string"
19
- },
20
- "created_by": {
21
- "type": "string"
22
- },
23
- "configuration": {
24
- "$ref": "configuration"
25
- },
26
- "locale": {
27
- "$ref": "service.locale"
28
- },
29
- "pages": {
30
- "type": "array",
31
- "items": {
32
- "$ref": "definition.page"
33
- }
34
- }
35
- },
36
- "required": [
37
- "_id",
38
- "_type",
39
- "service_name",
40
- "created_by",
41
- "configuration",
42
- "pages"
43
- ],
44
- "additionalProperties": false
45
- }
46
- },
47
- "required": ["metadata"]
48
- }
@@ -1,13 +0,0 @@
1
- {
2
- "$id": "http://gov.uk/schema/v1.0.0/request/versions",
3
- "_name": "request.versions",
4
- "title": "Create new service version",
5
- "description": "Request schema for creating a new version of a service",
6
- "type": "object",
7
- "properties": {
8
- "metadata": {
9
- "$ref": "service.base"
10
- }
11
- },
12
- "required": ["metadata"]
13
- }