metadata_presenter 0.18.4 → 0.21.0
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/helpers/metadata_presenter/application_helper.rb +6 -8
- data/app/helpers/metadata_presenter/default_text.rb +7 -0
- data/app/models/metadata_presenter/component.rb +5 -5
- data/app/models/metadata_presenter/item.rb +13 -0
- data/app/models/metadata_presenter/metadata.rb +8 -2
- data/app/models/metadata_presenter/page.rb +1 -1
- data/app/models/metadata_presenter/service.rb +3 -1
- data/app/presenters/metadata_presenter/page_answers_presenter.rb +6 -1
- data/app/views/metadata_presenter/attribute/_body.html.erb +8 -0
- data/app/views/metadata_presenter/attribute/_lede.html.erb +8 -0
- data/app/views/metadata_presenter/attribute/_section_heading.html.erb +8 -0
- data/app/views/metadata_presenter/component/_checkboxes.html.erb +4 -1
- data/app/views/metadata_presenter/component/_components.html.erb +20 -0
- data/app/views/metadata_presenter/component/_content.html.erb +1 -0
- data/app/views/metadata_presenter/component/_date.html.erb +4 -1
- data/app/views/metadata_presenter/component/_number.html.erb +4 -1
- data/app/views/metadata_presenter/component/_radios.html.erb +4 -1
- data/app/views/metadata_presenter/component/_text.html.erb +4 -1
- data/app/views/metadata_presenter/component/_textarea.html.erb +4 -1
- data/app/views/metadata_presenter/page/checkanswers.html.erb +10 -23
- data/app/views/metadata_presenter/page/confirmation.html.erb +13 -17
- data/app/views/metadata_presenter/page/content.html.erb +11 -34
- data/app/views/metadata_presenter/page/multiplequestions.html.erb +9 -18
- data/app/views/metadata_presenter/page/start.html.erb +4 -21
- data/config/initializers/default_text.rb +5 -0
- data/default_metadata/component/checkboxes.json +7 -4
- data/default_metadata/component/date.json +2 -1
- data/default_metadata/component/number.json +2 -1
- data/default_metadata/component/radios.json +7 -4
- data/default_metadata/component/text.json +1 -1
- data/default_metadata/component/textarea.json +1 -1
- data/default_metadata/page/confirmation.json +2 -1
- data/default_metadata/page/content.json +2 -2
- data/default_metadata/page/multiplequestions.json +1 -1
- data/default_metadata/page/singlequestion.json +1 -1
- data/default_text/content.json +7 -0
- data/fixtures/version.json +23 -5
- data/lib/metadata_presenter/version.rb +1 -1
- data/schemas/page/checkanswers.json +8 -10
- data/schemas/page/confirmation.json +8 -0
- data/schemas/page/content.json +8 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca4bd2a3c36d8d5c7c21cf4105aacb4b5cdd5e347a976c7a83d21dc473b35a86
|
4
|
+
data.tar.gz: eb4131ac71104e5c62772cf0a93176156eb946d7d968c1c1e36a92e9e2a5ad36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '068e67ec41b9add6e7d9629656dc0a3d39ed32ec0b374ba01599a0b29ec275db7296ebfd120eecd428d13c403cf4edb25a7843f3beba362004e723c74f75dd79'
|
7
|
+
data.tar.gz: 85c7e4caf55464ec1f95f85519f90aabd16c9324889daed683617736a5f54034645dc302248690ccdcd21ba908f4f930d06d421e70a1594e2fe48bb43658b68b
|
@@ -1,14 +1,8 @@
|
|
1
1
|
module MetadataPresenter
|
2
2
|
module ApplicationHelper
|
3
3
|
def main_title(component:, tag: :h1, classes: 'govuk-heading-xl')
|
4
|
-
|
5
|
-
|
6
|
-
component.legend
|
7
|
-
end
|
8
|
-
else
|
9
|
-
content_tag(tag, class: classes) do
|
10
|
-
component.label
|
11
|
-
end
|
4
|
+
content_tag(tag, class: classes) do
|
5
|
+
component.humanised_title
|
12
6
|
end
|
13
7
|
end
|
14
8
|
|
@@ -21,5 +15,9 @@ module MetadataPresenter
|
|
21
15
|
(Kramdown::Document.new(text).to_html).html_safe
|
22
16
|
end
|
23
17
|
alias to_markdown m
|
18
|
+
|
19
|
+
def default_text(property)
|
20
|
+
MetadataPresenter::DefaultText[property]
|
21
|
+
end
|
24
22
|
end
|
25
23
|
end
|
@@ -9,11 +9,11 @@ class MetadataPresenter::Component < MetadataPresenter::Metadata
|
|
9
9
|
|
10
10
|
def items
|
11
11
|
metadata.items.map do |item|
|
12
|
-
|
13
|
-
id: item['label'],
|
14
|
-
name: item['label'],
|
15
|
-
description: item['hint']
|
16
|
-
)
|
12
|
+
MetadataPresenter::Item.new(item, editor: editor?)
|
17
13
|
end
|
18
14
|
end
|
15
|
+
|
16
|
+
def content?
|
17
|
+
type == 'content'
|
18
|
+
end
|
19
19
|
end
|
@@ -4,8 +4,9 @@ class MetadataPresenter::Metadata
|
|
4
4
|
|
5
5
|
attr_reader :metadata
|
6
6
|
|
7
|
-
def initialize(metadata)
|
7
|
+
def initialize(metadata, editor: false)
|
8
8
|
@metadata = OpenStruct.new(metadata)
|
9
|
+
@editor = editor
|
9
10
|
end
|
10
11
|
|
11
12
|
def to_json
|
@@ -25,6 +26,11 @@ class MetadataPresenter::Metadata
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def method_missing(method_name, *args, &block)
|
28
|
-
metadata.send(method_name, *args, &block)
|
29
|
+
value = metadata.send(method_name, *args, &block)
|
30
|
+
value.blank? && editor? ? MetadataPresenter::DefaultText[method_name] : value
|
31
|
+
end
|
32
|
+
|
33
|
+
def editor?
|
34
|
+
@editor.present?
|
29
35
|
end
|
30
36
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class MetadataPresenter::Service < MetadataPresenter::Metadata
|
2
2
|
def pages
|
3
|
-
@_pages ||= metadata.pages.map
|
3
|
+
@_pages ||= metadata.pages.map do |page|
|
4
|
+
MetadataPresenter::Page.new(page, editor: editor?)
|
5
|
+
end
|
4
6
|
end
|
5
7
|
|
6
8
|
def start_page
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module MetadataPresenter
|
2
2
|
class PageAnswersPresenter
|
3
3
|
FIRST_ANSWER = 0.freeze
|
4
|
+
NO_USER_INPUT = %w(page.checkanswers page.confirmation page.content).freeze
|
4
5
|
|
5
6
|
def self.map(view:, pages:, answers:)
|
6
|
-
pages.map do |page|
|
7
|
+
user_input_pages(pages).map do |page|
|
7
8
|
Array(page.components).map do |component|
|
8
9
|
new(
|
9
10
|
view: view,
|
@@ -15,6 +16,10 @@ module MetadataPresenter
|
|
15
16
|
end.reject { |page| page.empty? }
|
16
17
|
end
|
17
18
|
|
19
|
+
def self.user_input_pages(pages)
|
20
|
+
pages.reject { |page| page.type.in?(NO_USER_INPUT) }
|
21
|
+
end
|
22
|
+
|
18
23
|
attr_reader :view, :component, :page, :answers
|
19
24
|
delegate :url, to: :page
|
20
25
|
delegate :humanised_title, to: :component
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% if @page.section_heading %>
|
2
|
+
<p class="fb-editable govuk-caption-l fb-section_heading"
|
3
|
+
data-fb-content-type="element"
|
4
|
+
data-fb-content-id="page[section_heading]"
|
5
|
+
data-fb-default-text="<%= default_text('section_heading') %>">
|
6
|
+
<%= @page.section_heading %>
|
7
|
+
</p>
|
8
|
+
<%- end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% @page.components.each_with_index do |component, index| %>
|
2
|
+
<div class="fb-editable"
|
3
|
+
id="<%= component.id %>"
|
4
|
+
data-fb-content-type="<%= component.type %>"
|
5
|
+
data-fb-content-id="<%= "page[components[#{index}]]" %>"
|
6
|
+
data-fb-content-data="<%= component.to_json %>">
|
7
|
+
|
8
|
+
<%= render partial: component, locals: {
|
9
|
+
f: f,
|
10
|
+
component: component,
|
11
|
+
component_id: "page[components[#{index}]]",
|
12
|
+
input_title: main_title(
|
13
|
+
component: component,
|
14
|
+
tag: :h2,
|
15
|
+
classes: classes
|
16
|
+
)
|
17
|
+
}
|
18
|
+
%>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= to_markdown(component.html) %>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
<%=
|
2
2
|
f.govuk_text_field component.id.to_sym,
|
3
3
|
label: { text: input_title },
|
4
|
-
hint: {
|
4
|
+
hint: {
|
5
|
+
data: { "fb-default-text" => default_text('hint') },
|
6
|
+
text: component.hint
|
7
|
+
},
|
5
8
|
name: "answers[#{component.name}]",
|
6
9
|
width: component.width_class_input.to_i
|
7
10
|
%>
|
@@ -1,7 +1,10 @@
|
|
1
1
|
<%=
|
2
2
|
f.govuk_text_area component.id.to_sym,
|
3
3
|
label: { text: input_title },
|
4
|
-
hint: {
|
4
|
+
hint: {
|
5
|
+
data: { "fb-default-text" => default_text('hint') },
|
6
|
+
text: component.hint
|
7
|
+
},
|
5
8
|
name: "answers[#{component.name}]",
|
6
9
|
max_chars: component.maxchars,
|
7
10
|
max_words: component.maxwords,
|
@@ -1,12 +1,7 @@
|
|
1
1
|
<div class="govuk-grid-row">
|
2
2
|
<div class="govuk-grid-column-two-thirds">
|
3
|
-
|
4
|
-
|
5
|
-
data-fb-content-type="element"
|
6
|
-
data-fb-content-id="page[section_heading]">
|
7
|
-
<%= @page.section_heading %>
|
8
|
-
</p>
|
9
|
-
<% end %>
|
3
|
+
|
4
|
+
<%= render partial: 'metadata_presenter/attribute/section_heading' %>
|
10
5
|
|
11
6
|
<% if @page.heading.present? %>
|
12
7
|
<h1 class="fb-editable govuk-heading-xl"
|
@@ -16,22 +11,6 @@
|
|
16
11
|
</h1>
|
17
12
|
<% end %>
|
18
13
|
|
19
|
-
<% if @page.lede.present? %>
|
20
|
-
<p class="fb-editable govuk-body-l"
|
21
|
-
data-fb-content-type="element"
|
22
|
-
data-fb-content-id="page[lede]">
|
23
|
-
<%= @page.lede %>
|
24
|
-
</p>
|
25
|
-
<% end %>
|
26
|
-
|
27
|
-
<% if @page.body.present? %>
|
28
|
-
<div class="fb-body fb-editable govuk-prose-scope"
|
29
|
-
data-fb-content-type="content"
|
30
|
-
data-fb-content-id="page[body]">
|
31
|
-
<%= @page.body %>
|
32
|
-
</div>
|
33
|
-
<% end %>
|
34
|
-
|
35
14
|
<%= form_for @page, url: reserved_submissions_path do |f| %>
|
36
15
|
<div data-block-id="page.checkanswers.answers" data-block-type="answers">
|
37
16
|
<dl class="fb-block fb-block-answers govuk-summary-list">
|
@@ -85,6 +64,14 @@
|
|
85
64
|
</div>
|
86
65
|
<% end %>
|
87
66
|
|
67
|
+
<%= render partial: 'metadata_presenter/component/components',
|
68
|
+
locals: {
|
69
|
+
f: f,
|
70
|
+
components: @page.components,
|
71
|
+
tag: nil,
|
72
|
+
classes: nil
|
73
|
+
} %>
|
74
|
+
|
88
75
|
<button <%= 'disabled' if editable? %> data-prevent-double-click="true" class="fb-block fb-block-actions govuk-button" data-module="govuk-button" data-block-id="actions" data-block-type="actions">
|
89
76
|
Accept and send application
|
90
77
|
</button>
|
@@ -5,23 +5,19 @@
|
|
5
5
|
<%= @page.heading %>
|
6
6
|
</h1>
|
7
7
|
|
8
|
-
|
9
|
-
<p class="fb-editable govuk-panel__body"
|
10
|
-
data-fb-content-type="element"
|
11
|
-
data-fb-content-id="page[lede]">
|
12
|
-
<%= @page.lede %>
|
13
|
-
</p>
|
14
|
-
<% end %>
|
8
|
+
<%= render 'metadata_presenter/attribute/lede' %>
|
15
9
|
</div>
|
16
10
|
|
17
|
-
|
18
|
-
<div class="govuk-grid-
|
19
|
-
|
20
|
-
<div class="fb-editable fb-body govuk-prose-scope"
|
21
|
-
data-fb-content-type="content"
|
22
|
-
data-fb-content-id="page[body]">
|
23
|
-
<%= @page.body %>
|
24
|
-
</div>
|
25
|
-
</div>
|
11
|
+
<div class="govuk-grid-row">
|
12
|
+
<div class="govuk-grid-column-two-thirds">
|
13
|
+
<%= render 'metadata_presenter/attribute/body' %>
|
26
14
|
</div>
|
27
|
-
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<%= render partial: 'metadata_presenter/component/components',
|
18
|
+
locals: {
|
19
|
+
f: nil,
|
20
|
+
components: @page.components,
|
21
|
+
tag: nil,
|
22
|
+
classes: nil
|
23
|
+
} %>
|
@@ -1,13 +1,8 @@
|
|
1
1
|
<div class="fb-main-grid-wrapper" data-fb-pagetype="<%= @page.type %>">
|
2
2
|
<div class="govuk-grid-row">
|
3
3
|
<div class="govuk-grid-column-two-thirds">
|
4
|
-
|
5
|
-
|
6
|
-
data-fb-content-type="element"
|
7
|
-
data-fb-content-id="page[section_heading]">
|
8
|
-
<%= @page.section_heading %>
|
9
|
-
</p>
|
10
|
-
<%- end %>
|
4
|
+
|
5
|
+
<%= render 'metadata_presenter/attribute/section_heading' %>
|
11
6
|
|
12
7
|
<% if @page.heading %>
|
13
8
|
<h1 class="fb-editable govuk-heading-xl"
|
@@ -17,37 +12,19 @@
|
|
17
12
|
</h1>
|
18
13
|
<% end %>
|
19
14
|
|
20
|
-
|
21
|
-
<div class="fb-editable govuk-body-l"
|
22
|
-
data-fb-content-id="page[lede]"
|
23
|
-
data-fb-content-type="element">
|
24
|
-
<%= @page.lede %>
|
25
|
-
</div>
|
26
|
-
<%- end %>
|
15
|
+
<%= render 'metadata_presenter/attribute/lede' %>
|
27
16
|
|
28
|
-
|
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 %>
|
17
|
+
<%= render 'metadata_presenter/attribute/body' %>
|
35
18
|
|
36
19
|
<%= form_for @page_answers, as: :answers, url: @page.url, method: :post do |f| %>
|
37
|
-
<%= f.govuk_error_summary %>
|
38
20
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
f: f,
|
47
|
-
input_title: main_title(component: component) }
|
48
|
-
%>
|
49
|
-
</div>
|
50
|
-
<% end %>
|
21
|
+
<%= render partial: 'metadata_presenter/component/components',
|
22
|
+
locals: {
|
23
|
+
f: f,
|
24
|
+
components: @page.components,
|
25
|
+
tag: nil,
|
26
|
+
classes: nil
|
27
|
+
} %>
|
51
28
|
|
52
29
|
<%= f.govuk_submit(disabled: editable?) %>
|
53
30
|
<% end %>
|
@@ -1,30 +1,21 @@
|
|
1
1
|
<div class="fb-main-grid-wrapper" data-block-id="<%= @page.id %>" data-block-type="page" data-block-pagetype="<%= @page.type %>">
|
2
2
|
<div class="govuk-grid-row">
|
3
3
|
<div class="govuk-grid-column-two-thirds">
|
4
|
-
|
5
|
-
|
6
|
-
data-fb-content-type="element"
|
7
|
-
data-fb-content-id="page[section_heading]">
|
8
|
-
<%= @page.section_heading %>
|
9
|
-
</p>
|
10
|
-
<%- end %>
|
4
|
+
|
5
|
+
<%= render 'metadata_presenter/attribute/section_heading' %>
|
11
6
|
|
12
7
|
<h1 class="govuk-heading-xl"><%= @page.heading %></h1>
|
13
8
|
|
14
9
|
<%= form_for @page_answers, as: :answers, url: @page.url, method: :post do |f| %>
|
15
10
|
<%= f.govuk_error_summary %>
|
16
|
-
|
17
|
-
|
18
|
-
component: component,
|
19
|
-
component_id: "page[components[#{index}]]",
|
11
|
+
|
12
|
+
<%= render partial: 'metadata_presenter/component/components', locals: {
|
20
13
|
f: f,
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
%>
|
27
|
-
<% end %>
|
14
|
+
components: @page.components,
|
15
|
+
tag: :h2,
|
16
|
+
classes: 'govuk-heading-m govuk-!-margin-top-8'
|
17
|
+
}
|
18
|
+
%>
|
28
19
|
|
29
20
|
<%= f.govuk_submit(disabled: editable?) %>
|
30
21
|
<% end %>
|
@@ -1,13 +1,8 @@
|
|
1
1
|
<div class="fb-main-grid-wrapper" data-fb-pagetype="<%= @page.type %>">
|
2
2
|
<div class="govuk-grid-row">
|
3
3
|
<div class="govuk-grid-column-two-thirds">
|
4
|
-
|
5
|
-
|
6
|
-
data-fb-content-type="element"
|
7
|
-
data-fb-content-id="page[section_heading]">
|
8
|
-
<%= @page.section_heading %>
|
9
|
-
</p>
|
10
|
-
<%- end %>
|
4
|
+
|
5
|
+
<%= render 'metadata_presenter/attribute/section_heading' %>
|
11
6
|
|
12
7
|
<% if @page.heading %>
|
13
8
|
<h1 class="fb-editable govuk-heading-xl"
|
@@ -17,21 +12,9 @@
|
|
17
12
|
</h1>
|
18
13
|
<% end %>
|
19
14
|
|
20
|
-
|
21
|
-
<div class="fb-editable"
|
22
|
-
data-fb-content-id="page[lede]"
|
23
|
-
data-fb-content-type="element">
|
24
|
-
<%= @page.lede %>
|
25
|
-
</div>
|
26
|
-
<%- end %>
|
15
|
+
<%= render 'metadata_presenter/attribute/lede' %>
|
27
16
|
|
28
|
-
|
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 %>
|
17
|
+
<%= render 'metadata_presenter/attribute/body' %>
|
35
18
|
|
36
19
|
<%= form_tag(root_path, method: :post) do %>
|
37
20
|
<button <%= 'disabled' if editable? %> class='govuk-button govuk-button--start govuk-!-margin-top-2'>
|
@@ -2,23 +2,26 @@
|
|
2
2
|
"_id": "component.checkboxes",
|
3
3
|
"_type": "checkboxes",
|
4
4
|
"errors": {},
|
5
|
-
"hint": "
|
5
|
+
"hint": "",
|
6
6
|
"items": [
|
7
7
|
{
|
8
8
|
"_id": "component_checkbox_1",
|
9
9
|
"_type": "checkbox",
|
10
10
|
"label": "Option",
|
11
|
-
"hint": "
|
11
|
+
"hint": "",
|
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": "
|
18
|
+
"hint": "",
|
19
19
|
"value": "value-2"
|
20
20
|
}
|
21
21
|
],
|
22
22
|
"name": "component-name",
|
23
|
-
"legend": "Question"
|
23
|
+
"legend": "Question",
|
24
|
+
"validation": {
|
25
|
+
"required": true
|
26
|
+
}
|
24
27
|
}
|
@@ -2,11 +2,12 @@
|
|
2
2
|
"_id": "component.date",
|
3
3
|
"_type": "date",
|
4
4
|
"errors": {},
|
5
|
-
"hint": "
|
5
|
+
"hint": "",
|
6
6
|
"legend": "Question",
|
7
7
|
"name": "component-name",
|
8
8
|
"date_type": "day-month-year",
|
9
9
|
"validation": {
|
10
|
+
"required": true,
|
10
11
|
"date": true
|
11
12
|
}
|
12
13
|
}
|
@@ -2,11 +2,12 @@
|
|
2
2
|
"_id": "component.number",
|
3
3
|
"_type": "number",
|
4
4
|
"errors": {},
|
5
|
-
"hint": "
|
5
|
+
"hint": "",
|
6
6
|
"label": "Question",
|
7
7
|
"name": "component-name",
|
8
8
|
"width_class_input": "10",
|
9
9
|
"validation": {
|
10
|
+
"required": true,
|
10
11
|
"number": true
|
11
12
|
}
|
12
13
|
}
|
@@ -2,23 +2,26 @@
|
|
2
2
|
"_id": "component.radios",
|
3
3
|
"_type": "radios",
|
4
4
|
"errors": {},
|
5
|
-
"hint": "
|
5
|
+
"hint": "",
|
6
6
|
"items": [
|
7
7
|
{
|
8
8
|
"_id": "component_radio_1",
|
9
9
|
"_type": "radio",
|
10
10
|
"label": "Option",
|
11
|
-
"hint": "
|
11
|
+
"hint": "",
|
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": "
|
18
|
+
"hint": "",
|
19
19
|
"value": "value-2"
|
20
20
|
}
|
21
21
|
],
|
22
22
|
"name": "component-name",
|
23
|
-
"legend": "Question"
|
23
|
+
"legend": "Question",
|
24
|
+
"validation": {
|
25
|
+
"required": true
|
26
|
+
}
|
24
27
|
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"_id": "page.content",
|
3
3
|
"_type": "page.content",
|
4
|
-
"section_heading": "
|
4
|
+
"section_heading": "",
|
5
5
|
"heading": "Title",
|
6
|
-
"lede": "
|
6
|
+
"lede": "",
|
7
7
|
"body": "[Optional content]",
|
8
8
|
"components": [],
|
9
9
|
"url": ""
|
data/fixtures/version.json
CHANGED
@@ -326,20 +326,31 @@
|
|
326
326
|
"section_heading": "Chain of Command",
|
327
327
|
"heading": "Tell me how many lights you see",
|
328
328
|
"body": "There are four lights!",
|
329
|
-
"components": [
|
329
|
+
"components": [
|
330
|
+
{
|
331
|
+
"_id": "how-many-lights_content_1",
|
332
|
+
"_type": "content",
|
333
|
+
"html": "What lights?"
|
334
|
+
}
|
335
|
+
],
|
330
336
|
"url": "how-many-lights"
|
331
337
|
},
|
332
338
|
{
|
333
339
|
"_uuid": "e819d0c2-7062-4997-89cf-44d26d098404",
|
334
340
|
"_id": "page._check-answers",
|
335
341
|
"_type": "page.checkanswers",
|
336
|
-
"body": "Optional content",
|
337
342
|
"heading": "Review your answer",
|
338
|
-
"lede": "First paragraph",
|
339
343
|
"section_heading": "This section is optional",
|
340
344
|
"send_body": "By submitting this answer you confirm all your answers",
|
341
345
|
"send_heading": "Send your answer",
|
342
|
-
"url": "/check-answers"
|
346
|
+
"url": "/check-answers",
|
347
|
+
"components": [
|
348
|
+
{
|
349
|
+
"_id": "check-answers_content_1",
|
350
|
+
"_type": "content",
|
351
|
+
"html": "Check yourself before you wreck yourself."
|
352
|
+
}
|
353
|
+
]
|
343
354
|
},
|
344
355
|
{
|
345
356
|
"_uuid": "b238a22f-c180-48d0-a7d9-8aad2036f1f2",
|
@@ -348,7 +359,14 @@
|
|
348
359
|
"body": "You'll receive a confirmation email",
|
349
360
|
"heading": "Complaint sent",
|
350
361
|
"lede": "Optional lede",
|
351
|
-
"url": "/confirmation"
|
362
|
+
"url": "/confirmation",
|
363
|
+
"components": [
|
364
|
+
{
|
365
|
+
"_id": "confirmation_content_1",
|
366
|
+
"_type": "content",
|
367
|
+
"html": "Some day I will be the most powerful Jedi ever!"
|
368
|
+
}
|
369
|
+
]
|
352
370
|
}
|
353
371
|
],
|
354
372
|
"locale": "en"
|
@@ -17,16 +17,6 @@
|
|
17
17
|
"type": "string",
|
18
18
|
"default": "Check your answers"
|
19
19
|
},
|
20
|
-
"lede": {
|
21
|
-
"title": "Lede",
|
22
|
-
"type": "string",
|
23
|
-
"description": "Content before the body"
|
24
|
-
},
|
25
|
-
"body": {
|
26
|
-
"title": "Body",
|
27
|
-
"type": "string",
|
28
|
-
"description": "Optional content before showing the summary"
|
29
|
-
},
|
30
20
|
"summary_of": {
|
31
21
|
"title": "Summary of",
|
32
22
|
"description": "Page/section that summary summarises"
|
@@ -45,6 +35,14 @@
|
|
45
35
|
"content": true,
|
46
36
|
"multiline": true,
|
47
37
|
"default": "By submitting this application you confirm that, to the best of your knowledge, the details you are providing are correct."
|
38
|
+
},
|
39
|
+
"components": {
|
40
|
+
"title": "Components",
|
41
|
+
"description": "The form or content elements used on the page",
|
42
|
+
"type": "array",
|
43
|
+
"items": {
|
44
|
+
"$ref": "component.content"
|
45
|
+
}
|
48
46
|
}
|
49
47
|
},
|
50
48
|
"required": [
|
@@ -19,6 +19,14 @@
|
|
19
19
|
},
|
20
20
|
"lede": {
|
21
21
|
"multiline": true
|
22
|
+
},
|
23
|
+
"components": {
|
24
|
+
"title": "Components",
|
25
|
+
"description": "The form or content elements used on the page",
|
26
|
+
"type": "array",
|
27
|
+
"items": {
|
28
|
+
"$ref": "component.content"
|
29
|
+
}
|
22
30
|
}
|
23
31
|
},
|
24
32
|
"required": [
|
data/schemas/page/content.json
CHANGED
@@ -7,6 +7,14 @@
|
|
7
7
|
"properties": {
|
8
8
|
"_type": {
|
9
9
|
"const": "page.content"
|
10
|
+
},
|
11
|
+
"components": {
|
12
|
+
"title": "Components",
|
13
|
+
"description": "The form or content elements used on the page",
|
14
|
+
"type": "array",
|
15
|
+
"items": {
|
16
|
+
"$ref": "component.content"
|
17
|
+
}
|
10
18
|
}
|
11
19
|
},
|
12
20
|
"allOf": [
|
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.
|
4
|
+
version: 0.21.0
|
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-
|
11
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -231,9 +231,11 @@ files:
|
|
231
231
|
- app/controllers/metadata_presenter/service_controller.rb
|
232
232
|
- app/controllers/metadata_presenter/submissions_controller.rb
|
233
233
|
- app/helpers/metadata_presenter/application_helper.rb
|
234
|
+
- app/helpers/metadata_presenter/default_text.rb
|
234
235
|
- app/jobs/metadata_presenter/application_job.rb
|
235
236
|
- app/models/metadata_presenter/component.rb
|
236
237
|
- app/models/metadata_presenter/date_field.rb
|
238
|
+
- app/models/metadata_presenter/item.rb
|
237
239
|
- app/models/metadata_presenter/metadata.rb
|
238
240
|
- app/models/metadata_presenter/next_page.rb
|
239
241
|
- app/models/metadata_presenter/page.rb
|
@@ -250,7 +252,12 @@ files:
|
|
250
252
|
- app/validators/metadata_presenter/validate_schema.rb
|
251
253
|
- app/views/errors/404.html
|
252
254
|
- app/views/layouts/metadata_presenter/application.html.erb
|
255
|
+
- app/views/metadata_presenter/attribute/_body.html.erb
|
256
|
+
- app/views/metadata_presenter/attribute/_lede.html.erb
|
257
|
+
- app/views/metadata_presenter/attribute/_section_heading.html.erb
|
253
258
|
- app/views/metadata_presenter/component/_checkboxes.html.erb
|
259
|
+
- app/views/metadata_presenter/component/_components.html.erb
|
260
|
+
- app/views/metadata_presenter/component/_content.html.erb
|
254
261
|
- app/views/metadata_presenter/component/_date.html.erb
|
255
262
|
- app/views/metadata_presenter/component/_number.html.erb
|
256
263
|
- app/views/metadata_presenter/component/_radios.html.erb
|
@@ -266,6 +273,7 @@ files:
|
|
266
273
|
- app/views/metadata_presenter/page/singlequestion.html.erb
|
267
274
|
- app/views/metadata_presenter/page/start.html.erb
|
268
275
|
- config/initializers/default_metadata.rb
|
276
|
+
- config/initializers/default_text.rb
|
269
277
|
- config/initializers/schemas.rb
|
270
278
|
- config/routes.rb
|
271
279
|
- default_metadata/component/checkboxes.json
|
@@ -291,6 +299,7 @@ files:
|
|
291
299
|
- default_metadata/string/error.min_length.json
|
292
300
|
- default_metadata/string/error.number.json
|
293
301
|
- default_metadata/string/error.required.json
|
302
|
+
- default_text/content.json
|
294
303
|
- fixtures/non_finished_service.json
|
295
304
|
- fixtures/service.json
|
296
305
|
- fixtures/version.json
|