metadata_presenter 0.28.4 → 0.28.9
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 +0 -4
- data/app/models/metadata_presenter/metadata.rb +4 -0
- data/app/models/metadata_presenter/page.rb +22 -6
- data/app/views/layouts/metadata_presenter/application.html.erb +1 -1
- data/app/views/metadata_presenter/component/_components.html.erb +3 -3
- data/app/views/metadata_presenter/footer/_meta.html.erb +1 -1
- data/app/views/metadata_presenter/page/checkanswers.html.erb +1 -3
- data/default_metadata/page/start.json +1 -1
- data/fixtures/version.json +9 -2
- data/lib/metadata_presenter/version.rb +1 -1
- data/schemas/page/checkanswers.json +0 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4d5dbea9a24b8fae69170d03e8ff69dafd77a0b858013baee1c8c1434fdcca1
|
4
|
+
data.tar.gz: 415da25856e17541de78ece98f8539471e33ae8417285630ef00a55152982999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 770aed14f9470f3d1f0af53e0411e3f190aa92268a031eb0cfd8af5aea8822e1b9aed8544db21d494cd897ac48f43676ae35a1ac7ce6fefd2a7fc96be59151d7
|
7
|
+
data.tar.gz: c64ee626011dd6027f48c6a98e86309efc8b8671d1f52cb7ead124650a7cb23d1d3c9850a49f6e3dace01297f7a94b5ee8111e8bd98b931cd8f7933f8885183a
|
@@ -5,22 +5,29 @@ module MetadataPresenter
|
|
5
5
|
class Page < MetadataPresenter::Metadata
|
6
6
|
include ActiveModel::Validations
|
7
7
|
|
8
|
-
|
8
|
+
NOT_EDITABLE = %i[
|
9
9
|
_uuid
|
10
|
-
|
10
|
+
_id
|
11
|
+
_type
|
12
|
+
steps
|
13
|
+
add_component
|
14
|
+
add_extra_component
|
15
|
+
].freeze
|
11
16
|
|
12
17
|
def ==(other)
|
13
18
|
id == other.id if other.respond_to? :id
|
14
19
|
end
|
15
20
|
|
16
21
|
def editable_attributes
|
17
|
-
to_h.reject { |k, _| k.in?(
|
22
|
+
to_h.reject { |k, _| k.in?(NOT_EDITABLE) }
|
18
23
|
end
|
19
24
|
|
20
25
|
def components
|
21
|
-
metadata.components
|
22
|
-
|
23
|
-
|
26
|
+
to_components(metadata.components, collection: :components)
|
27
|
+
end
|
28
|
+
|
29
|
+
def extra_components
|
30
|
+
to_components(metadata.extra_components, collection: :extra_components)
|
24
31
|
end
|
25
32
|
|
26
33
|
def to_partial_path
|
@@ -41,6 +48,15 @@ module MetadataPresenter
|
|
41
48
|
|
42
49
|
private
|
43
50
|
|
51
|
+
def to_components(node_components, collection:)
|
52
|
+
node_components&.map do |component|
|
53
|
+
MetadataPresenter::Component.new(
|
54
|
+
component.merge(collection: collection),
|
55
|
+
editor: editor?
|
56
|
+
)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
44
60
|
def page_components(page_type)
|
45
61
|
values = Rails.application.config.page_components[page_type]
|
46
62
|
if values.blank?
|
@@ -1,14 +1,14 @@
|
|
1
|
-
<%
|
1
|
+
<% components.each_with_index do |component, index| %>
|
2
2
|
<div class="fb-editable"
|
3
3
|
id="<%= component.id %>"
|
4
4
|
data-fb-content-type="<%= component.type %>"
|
5
|
-
data-fb-content-id="<%= "page[
|
5
|
+
data-fb-content-id="<%= "page[#{component.collection}[#{index}]]" %>"
|
6
6
|
data-fb-content-data="<%= component.to_json %>">
|
7
7
|
|
8
8
|
<%= render partial: component, locals: {
|
9
9
|
f: f,
|
10
10
|
component: component,
|
11
|
-
component_id: "page[
|
11
|
+
component_id: "page[#{component.collection}[#{index}]]",
|
12
12
|
input_title: main_title(
|
13
13
|
component: component,
|
14
14
|
tag: :h2,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h2 class="govuk-visually-hidden">Support links</h2>
|
2
2
|
<ul class="govuk-footer__inline-list">
|
3
|
-
<%
|
3
|
+
<% service.meta.items.each do |item| %>
|
4
4
|
<li class="govuk-footer__inline-list-item">
|
5
5
|
<a class="govuk-footer__link" href=<%= File.join(request.script_name, item.href) %>><%= item.text %></a>
|
6
6
|
</li>
|
@@ -2,8 +2,6 @@
|
|
2
2
|
<div class="govuk-grid-row">
|
3
3
|
<div class="govuk-grid-column-two-thirds">
|
4
4
|
|
5
|
-
<%= render partial: 'metadata_presenter/attribute/section_heading' %>
|
6
|
-
|
7
5
|
<h1 class="fb-editable govuk-heading-xl"
|
8
6
|
data-fb-content-type="element"
|
9
7
|
data-fb-content-id="page[heading]">
|
@@ -44,7 +42,7 @@
|
|
44
42
|
</dd>
|
45
43
|
<dd class="govuk-summary-list__actions">
|
46
44
|
<%= link_to(
|
47
|
-
change_answer_path(url: page_answers_presenter.url),
|
45
|
+
editable? ? '#' : change_answer_path(url: page_answers_presenter.url),
|
48
46
|
class: 'govuk-link'
|
49
47
|
) do %>
|
50
48
|
Change<span class="govuk-visually-hidden"> Your answer for <%= page_answers_presenter.humanised_title %></span>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"_id": "page.start",
|
3
3
|
"_type": "page.start",
|
4
4
|
"heading": "Service name goes here",
|
5
|
-
"lede": "
|
5
|
+
"lede": "",
|
6
6
|
"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.",
|
7
7
|
"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.",
|
8
8
|
"steps": [],
|
data/fixtures/version.json
CHANGED
@@ -340,18 +340,25 @@
|
|
340
340
|
"_id": "page._check-answers",
|
341
341
|
"_type": "page.checkanswers",
|
342
342
|
"heading": "Review your answer",
|
343
|
-
"section_heading": "This section is optional",
|
344
343
|
"send_body": "By submitting this answer you confirm all your answers",
|
345
344
|
"send_heading": "Send your answer",
|
346
345
|
"url": "/check-answers",
|
347
346
|
"components": [
|
348
347
|
{
|
348
|
+
"_uuid": "256291c2-8ffa-4bda-8282-88e0724ccd10",
|
349
349
|
"_id": "check-answers_content_1",
|
350
350
|
"_type": "content",
|
351
351
|
"content": "Check yourself before you wreck yourself."
|
352
352
|
}
|
353
353
|
],
|
354
|
-
"extra_components": [
|
354
|
+
"extra_components": [
|
355
|
+
{
|
356
|
+
"_uuid": "09961c6a-29f8-4d4f-a6d2-af00cff15536",
|
357
|
+
"_id": "check-answers_content_1",
|
358
|
+
"_type": "content",
|
359
|
+
"content": "Take the cannoli."
|
360
|
+
}
|
361
|
+
]
|
355
362
|
},
|
356
363
|
{
|
357
364
|
"_uuid": "b238a22f-c180-48d0-a7d9-8aad2036f1f2",
|
@@ -8,11 +8,6 @@
|
|
8
8
|
"_type": {
|
9
9
|
"const": "page.checkanswers"
|
10
10
|
},
|
11
|
-
"section_heading": {
|
12
|
-
"title": "Section heading",
|
13
|
-
"type": "string",
|
14
|
-
"description": "Section to display before the heading"
|
15
|
-
},
|
16
11
|
"heading": {
|
17
12
|
"type": "string",
|
18
13
|
"default": "Check your answers"
|
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.28.
|
4
|
+
version: 0.28.9
|
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-04-
|
11
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|