metadata_presenter 0.16.0 → 0.18.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15e470bd0e87527625fba6e246f2e9a43bf3523bc7689ecb1bfd18d760bca18c
4
- data.tar.gz: 90dc8301fa94e80d07f7072f009ba44f79d4741e80539f5331bb27440d8672f6
3
+ metadata.gz: 39243c82109a4213ccb32b9181e7f7f678053b8d040c9d324af854ba56cbdf64
4
+ data.tar.gz: cdd2916ab5aa68fac64832a5a8056006c224a30564f83056742527edf3ce99f5
5
5
  SHA512:
6
- metadata.gz: 873b081845358aa9569833889372ec358f034add8e6f6437b62c32ad8c3aa98d8292a86e605e7109f2d62a8ca5073a40e5354289b10369401f2975a5ff4cb89a
7
- data.tar.gz: d3ffa82016eb6b56825ca39e9ef01b93f903a5488d2a1e5599474b2c04d0654a718dc6a3f1528fcb26ce69fc89dabcfcb757d206aceeb668163be4bff729ae6c
6
+ metadata.gz: df8cf17ae39577882fc9ae3a71558fba5fc109369e8523de234d636040df2414fea491c719d3ba68089243a32f61e8fe6c21ebdebb293670927793bd31895907
7
+ data.tar.gz: c61978f1ab47fadd20681cbf2095293b398cc6ad3e27d514ba2414a76ba2023f3f1b03bb4b6ff277635ead18941228a6401f32c76d41db29fc99ab281bbe164d
@@ -2,10 +2,8 @@ module MetadataPresenter
2
2
  module ApplicationHelper
3
3
  def main_title(component:, tag: :h1, classes: 'govuk-heading-xl')
4
4
  if component.legend.present?
5
- content_tag(:legend, class: 'govuk-fieldset__legend govuk-fieldset__legend--l') do
6
- content_tag(tag, class: classes) do
7
- component.legend
8
- end
5
+ content_tag(:h1, class: 'govuk-heading-xl') do
6
+ component.legend
9
7
  end
10
8
  else
11
9
  content_tag(tag, class: classes) do
@@ -1,8 +1,6 @@
1
- <div class="fb-editable" data-fb-content-type="<%= component._type %>" data-fb-content-id="<%= component_id %>" data-fb-content-data="<%= component.to_json %>">
2
- <%=
3
- f.govuk_text_field component.id.to_sym,
4
- label: { text: input_title },
5
- hint: { text: component.hint },
6
- name: "answers[#{component.name}]"
7
- %>
8
- </div>
1
+ <%=
2
+ f.govuk_text_field component.id.to_sym,
3
+ label: { text: input_title },
4
+ hint: { text: component.hint },
5
+ name: "answers[#{component.name}]"
6
+ %>
@@ -1,12 +1,10 @@
1
- <div class="fb-editable" data-fb-content-type="<%= component._type %>" data-fb-content-id="<%= component_id %>" data-fb-content-data="<%= component.to_json %>">
2
- <%=
3
- f.govuk_text_area component.id.to_sym,
4
- label: { text: input_title },
5
- hint: { text: component.hint },
6
- name: "answers[#{component.name}]",
7
- max_chars: component.maxchars,
8
- max_words: component.maxwords,
9
- threshold: component.threshold,
10
- rows: component.rows
11
- %>
12
- </div>
1
+ <%=
2
+ f.govuk_text_area component.id.to_sym,
3
+ label: { text: input_title },
4
+ hint: { text: component.hint },
5
+ name: "answers[#{component.name}]",
6
+ max_chars: component.maxchars,
7
+ max_words: component.maxwords,
8
+ threshold: component.threshold,
9
+ rows: component.rows
10
+ %>
@@ -1,4 +1,4 @@
1
- <footer class="govuk-footer " role="contentinfo">
1
+ <footer class="govuk-footer fb-footer" role="contentinfo">
2
2
  <div class="govuk-width-container ">
3
3
  <div class="govuk-footer__meta">
4
4
  <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
@@ -0,0 +1,56 @@
1
+ <div class="fb-main-grid-wrapper" data-fb-pagetype="<%= @page.type %>">
2
+ <div class="govuk-grid-row">
3
+ <div class="govuk-grid-column-two-thirds">
4
+ <% if @page.section_heading -%>
5
+ <p class="fb-editable govuk-caption-l fb-section_heading"
6
+ data-fb-content-type="element"
7
+ data-fb-content-id="page[section_heading]">
8
+ <%= @page.section_heading.html_safe %>
9
+ </p>
10
+ <%- end %>
11
+
12
+ <% if @page.heading %>
13
+ <h1 class="fb-editable govuk-heading-xl"
14
+ data-fb-content-id="page[heading]"
15
+ data-fb-content-type="element">
16
+ <%= @page.heading.html_safe %>
17
+ </h1>
18
+ <% end %>
19
+
20
+ <% if @page.lede %>
21
+ <div class="fb-editable"
22
+ data-fb-content-id="page[lede]"
23
+ data-fb-content-type="content">
24
+ <%= @page.lede.html_safe %>
25
+ </div>
26
+ <%- end %>
27
+
28
+ <% if @page.body %>
29
+ <div class="fb-editable"
30
+ data-fb-content-id="page[body]"
31
+ data-fb-content-type="content">
32
+ <%= to_markdown(@page.body) %>
33
+ </div>
34
+ <%- end %>
35
+
36
+ <%= form_for @page_answers, as: :answers, url: @page.url, method: :post do |f| %>
37
+ <%= f.govuk_error_summary %>
38
+
39
+ <% @page.components.each_with_index do |component, index| %>
40
+ <div class="fb-editable"
41
+ data-fb-content-type="<%= component._type %>"
42
+ data-fb-content-id="<%= "page[components[#{index}]]" %>"
43
+ data-fb-content-data="<%= component.to_json %>">
44
+ <%= render partial: component, locals: {
45
+ component: component,
46
+ f: f,
47
+ input_title: main_title(component: component) }
48
+ %>
49
+ </div>
50
+ <% end %>
51
+
52
+ <%= f.govuk_submit(disabled: editable?) %>
53
+ <% end %>
54
+ </div>
55
+ </div>
56
+ </div>
@@ -3,13 +3,18 @@
3
3
  <div class="govuk-grid-column-two-thirds">
4
4
  <%= form_for @page_answers, as: :answers, url: @page.url, method: :post do |f| %>
5
5
  <%= f.govuk_error_summary %>
6
+
6
7
  <% @page.components.each_with_index do |component, index| %>
7
- <%= render partial: component, locals: {
8
- component: component,
9
- component_id: "page[components[#{index}]]",
10
- f: f,
11
- input_title: main_title(component: component) }
12
- %>
8
+ <div class="fb-editable"
9
+ data-fb-content-type="<%= component._type %>"
10
+ data-fb-content-id="<%= "page[components[#{index}]]" %>"
11
+ data-fb-content-data="<%= component.to_json %>">
12
+ <%= render partial: component, locals: {
13
+ component: component,
14
+ f: f,
15
+ input_title: main_title(component: component) }
16
+ %>
17
+ </div>
13
18
  <% end %>
14
19
 
15
20
  <%= f.govuk_submit(disabled: editable?) %>
@@ -10,7 +10,7 @@
10
10
  <%- end %>
11
11
 
12
12
  <% if @page.heading %>
13
- <h1 class="fb-editable <%= @page.heading_class %>"
13
+ <h1 class="fb-editable govuk-heading-xl"
14
14
  data-fb-content-id="page[heading]"
15
15
  data-fb-content-type="element">
16
16
  <%= @page.heading.html_safe %>
@@ -2,20 +2,20 @@
2
2
  "_id": "component.checkboxes",
3
3
  "_type": "checkboxes",
4
4
  "errors": {},
5
- "hint": "[Hint text (optional)]",
5
+ "hint": "[Optional hint text]",
6
6
  "items": [
7
7
  {
8
8
  "_id": "component_checkbox_1",
9
9
  "_type": "checkbox",
10
10
  "label": "Option",
11
- "hint": "[Hint text (optional)]",
11
+ "hint": "[Optional hint text]",
12
12
  "value": "value-1"
13
13
  },
14
14
  {
15
15
  "_id": "component_checkbox_2",
16
16
  "_type": "checkbox",
17
17
  "label": "Option",
18
- "hint": "[Hint text (optional)]",
18
+ "hint": "[Optional hint text]",
19
19
  "value": "value-2"
20
20
  }
21
21
  ],
@@ -0,0 +1,5 @@
1
+ {
2
+ "_id": "component.content",
3
+ "_type": "content",
4
+ "html": "[Optional content]"
5
+ }
@@ -2,8 +2,8 @@
2
2
  "_id": "component.date",
3
3
  "_type": "date",
4
4
  "errors": {},
5
- "hint": "Component hint",
6
- "legend": "Component legend",
5
+ "hint": "[Optional hint text]",
6
+ "legend": "Question",
7
7
  "name": "component-name",
8
8
  "date_type": "day-month-year",
9
9
  "validation": {
@@ -2,8 +2,8 @@
2
2
  "_id": "component.number",
3
3
  "_type": "number",
4
4
  "errors": {},
5
- "hint": "Component hint",
6
- "label": "Component label",
5
+ "hint": "[Optional hint text]",
6
+ "label": "Question",
7
7
  "name": "component-name",
8
8
  "width_class_input": "10",
9
9
  "validation": {
@@ -2,20 +2,20 @@
2
2
  "_id": "component.radios",
3
3
  "_type": "radios",
4
4
  "errors": {},
5
- "hint": "[Hint text (optional)]",
5
+ "hint": "[Optional hint text]",
6
6
  "items": [
7
7
  {
8
8
  "_id": "component_radio_1",
9
9
  "_type": "radio",
10
10
  "label": "Option",
11
- "hint": "[Hint text (optional)]",
11
+ "hint": "[Optional hint text]",
12
12
  "value": "value-1"
13
13
  },
14
14
  {
15
15
  "_id": "component_radio_2",
16
16
  "_type": "radio",
17
17
  "label": "Option",
18
- "hint": "[Hint text (optional)]",
18
+ "hint": "[Optional hint text]",
19
19
  "value": "value-2"
20
20
  }
21
21
  ],
@@ -3,7 +3,7 @@
3
3
  "_type": "text",
4
4
  "errors": {},
5
5
  "label": "Question",
6
- "hint": "Hint (optional)",
6
+ "hint": "[Optional hint text]",
7
7
  "name": "component-name",
8
8
  "validation": {
9
9
  "required": true
@@ -2,8 +2,8 @@
2
2
  "_id": "component.textarea",
3
3
  "_type": "textarea",
4
4
  "errors": {},
5
- "hint": "Component hint",
6
- "label": "Component label",
5
+ "hint": "[Optional hint text]",
6
+ "label": "Question",
7
7
  "name": "component-name",
8
8
  "rows": 5,
9
9
  "validation": {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "_id": "page.confirmation",
3
3
  "_type": "page.confirmation",
4
- "heading": "Required - Confirmation"
4
+ "heading": "Application complete"
5
5
  }
@@ -0,0 +1,10 @@
1
+ {
2
+ "_id": "page.content",
3
+ "_type": "page.content",
4
+ "section_heading": "[Optional section heading]",
5
+ "heading": "Title",
6
+ "lede": "[Optional lead paragraph]",
7
+ "body": "[Optional content]",
8
+ "components": [],
9
+ "url": ""
10
+ }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_id": "page.multiplequestions",
3
3
  "_type": "page.multiplequestions",
4
- "section_heading": "[Section heading (optional)]",
5
- "heading": "Question",
4
+ "section_heading": "[Optional section heading]",
5
+ "heading": "Title",
6
6
  "components": [],
7
7
  "url": ""
8
8
  }
@@ -319,6 +319,16 @@
319
319
  "section_heading": "That's no moon",
320
320
  "url": "/star-wars-knowledge"
321
321
  },
322
+ {
323
+ "_uuid": "1ed3e4ad-5098-41c9-b4b6-426e89f7804e",
324
+ "_id": "page.how-many-lights",
325
+ "_type": "page.content",
326
+ "section_heading": "Chain of Command",
327
+ "heading": "Tell me how many lights you see",
328
+ "body": "There are four lights!",
329
+ "components": [],
330
+ "url": "how-many-lights"
331
+ },
322
332
  {
323
333
  "_uuid": "e819d0c2-7062-4997-89cf-44d26d098404",
324
334
  "_id": "page._check-answers",
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '0.16.0'
2
+ VERSION = '0.18.1'
3
3
  end
@@ -0,0 +1,30 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/content",
3
+ "_name": "component.content",
4
+ "title": "Content",
5
+ "description": "Display ‘flat’ content, such as text",
6
+ "type": "object",
7
+ "category": [
8
+ "content"
9
+ ],
10
+ "properties": {
11
+ "_type": {
12
+ "const": "content"
13
+ },
14
+ "html": {
15
+ "title": "Content",
16
+ "description": "Content to display - use [markdown](https://www.gov.uk/guidance/how-to-publish-on-gov-uk/markdown) to format text or add hyperlinks",
17
+ "type": "string",
18
+ "content": true,
19
+ "multiline": true
20
+ }
21
+ },
22
+ "allOf": [
23
+ {
24
+ "$ref": "definition.component"
25
+ }
26
+ ],
27
+ "required": [
28
+ "html"
29
+ ]
30
+ }
@@ -100,6 +100,8 @@
100
100
  ],
101
101
  "required": [
102
102
  "_uuid",
103
+ "_id",
104
+ "_type",
103
105
  "url"
104
106
  ],
105
107
  "category": [
@@ -48,13 +48,10 @@
48
48
  }
49
49
  },
50
50
  "required": [
51
- "_id",
52
- "_type",
53
51
  "heading",
54
52
  "send_heading",
55
53
  "send_body"
56
54
  ],
57
- "additionalProperties": false,
58
55
  "allOf": [
59
56
  {
60
57
  "$ref": "definition.page.form"
@@ -22,11 +22,8 @@
22
22
  }
23
23
  },
24
24
  "required": [
25
- "_id",
26
- "_type",
27
25
  "heading"
28
26
  ],
29
- "additionalProperties": false,
30
27
  "allOf": [
31
28
  {
32
29
  "$ref": "definition.page.content"
@@ -0,0 +1,23 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/page/content",
3
+ "_name": "page.content",
4
+ "title": "Content",
5
+ "description": "Display content to users without asking any questions",
6
+ "type": "object",
7
+ "properties": {
8
+ "_type": {
9
+ "const": "page.content"
10
+ }
11
+ },
12
+ "allOf": [
13
+ {
14
+ "$ref": "definition.page.content"
15
+ }
16
+ ],
17
+ "uiCategory": {
18
+ "main": [
19
+ "lede",
20
+ "body"
21
+ ]
22
+ }
23
+ }
@@ -21,6 +21,7 @@
21
21
  }
22
22
  ],
23
23
  "required": [
24
+ "heading",
24
25
  "components"
25
26
  ],
26
27
  "surplus_properties": [
@@ -37,8 +37,6 @@
37
37
  ]
38
38
  },
39
39
  "required": [
40
- "_id",
41
- "_type",
42
40
  "heading",
43
41
  "steps"
44
42
  ]
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.16.0
4
+ version: 0.18.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-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -260,6 +260,7 @@ files:
260
260
  - app/views/metadata_presenter/header/show.html.erb
261
261
  - app/views/metadata_presenter/page/checkanswers.html.erb
262
262
  - app/views/metadata_presenter/page/confirmation.html.erb
263
+ - app/views/metadata_presenter/page/content.html.erb
263
264
  - app/views/metadata_presenter/page/form.html.erb
264
265
  - app/views/metadata_presenter/page/multiplequestions.html.erb
265
266
  - app/views/metadata_presenter/page/singlequestion.html.erb
@@ -268,6 +269,7 @@ files:
268
269
  - config/initializers/schemas.rb
269
270
  - config/routes.rb
270
271
  - default_metadata/component/checkboxes.json
272
+ - default_metadata/component/content.json
271
273
  - default_metadata/component/date.json
272
274
  - default_metadata/component/number.json
273
275
  - default_metadata/component/radios.json
@@ -279,6 +281,7 @@ files:
279
281
  - default_metadata/definition/radio.json
280
282
  - default_metadata/page/checkanswers.json
281
283
  - default_metadata/page/confirmation.json
284
+ - default_metadata/page/content.json
282
285
  - default_metadata/page/multiplequestions.json
283
286
  - default_metadata/page/singlequestion.json
284
287
  - default_metadata/page/start.json
@@ -297,6 +300,7 @@ files:
297
300
  - lib/metadata_presenter/version.rb
298
301
  - lib/tasks/metadata_presenter_tasks.rake
299
302
  - schemas/component/checkboxes.json
303
+ - schemas/component/content.json
300
304
  - schemas/component/date.json
301
305
  - schemas/component/number.json
302
306
  - schemas/component/radios.json
@@ -344,6 +348,7 @@ files:
344
348
  - schemas/link/link.json
345
349
  - schemas/page/checkanswers.json
346
350
  - schemas/page/confirmation.json
351
+ - schemas/page/content.json
347
352
  - schemas/page/multiplequestions.json
348
353
  - schemas/page/singlequestion.json
349
354
  - schemas/page/start.json