metadata_presenter 0.28.7 → 0.28.12
Sign up to get free protection for your applications and to get access to all the features.
- 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 +14 -6
- data/app/presenters/metadata_presenter/page_answers_presenter.rb +16 -3
- data/app/views/metadata_presenter/footer/_meta.html.erb +1 -1
- data/app/views/metadata_presenter/page/checkanswers.html.erb +5 -2
- data/config/initializers/page_components.rb +13 -9
- data/default_metadata/page/start.json +1 -1
- data/fixtures/version.json +8 -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: b14ecefbf796aa68584e1a79715522cd1c3c49b97b528eed86c685206ab65d35
|
4
|
+
data.tar.gz: a264dc36811814d20c328b13b93d0d19e08bd3e24dae1b9a07e7be8a6d91e0f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b902a201d3f224c50196ceb2809829c46eed5a093b3cc94715612a2da5b0deffab0749efbde851778fadaa1724b89be6facab64785fe8774ed2e3c0cd5b08c0
|
7
|
+
data.tar.gz: 446500e1d6a8a141d66ea70f761c874ffc0da245469ebc35985331d60e4cb75405f2bbdbc58d1fad3974ad8debf81ba7351968abc4698dbf19e267666656e6db
|
@@ -14,10 +14,6 @@ module MetadataPresenter
|
|
14
14
|
add_extra_component
|
15
15
|
].freeze
|
16
16
|
|
17
|
-
def uuid
|
18
|
-
_uuid
|
19
|
-
end
|
20
|
-
|
21
17
|
def ==(other)
|
22
18
|
id == other.id if other.respond_to? :id
|
23
19
|
end
|
@@ -26,6 +22,10 @@ module MetadataPresenter
|
|
26
22
|
to_h.reject { |k, _| k.in?(NOT_EDITABLE) }
|
27
23
|
end
|
28
24
|
|
25
|
+
def all_components
|
26
|
+
[components, extra_components].flatten.compact
|
27
|
+
end
|
28
|
+
|
29
29
|
def components
|
30
30
|
to_components(metadata.components, collection: :components)
|
31
31
|
end
|
@@ -34,6 +34,14 @@ module MetadataPresenter
|
|
34
34
|
to_components(metadata.extra_components, collection: :extra_components)
|
35
35
|
end
|
36
36
|
|
37
|
+
def components_by_type(type)
|
38
|
+
supported_components = page_components(raw_type)[type]
|
39
|
+
|
40
|
+
all_components.select do |component|
|
41
|
+
supported_components.include?(component.type)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
37
45
|
def to_partial_path
|
38
46
|
type.gsub('.', '/')
|
39
47
|
end
|
@@ -43,11 +51,11 @@ module MetadataPresenter
|
|
43
51
|
end
|
44
52
|
|
45
53
|
def input_components
|
46
|
-
page_components(raw_type)[:
|
54
|
+
page_components(raw_type)[:input]
|
47
55
|
end
|
48
56
|
|
49
57
|
def content_components
|
50
|
-
page_components(raw_type)[:
|
58
|
+
page_components(raw_type)[:content]
|
51
59
|
end
|
52
60
|
|
53
61
|
private
|
@@ -1,11 +1,16 @@
|
|
1
1
|
module MetadataPresenter
|
2
2
|
class PageAnswersPresenter
|
3
3
|
FIRST_ANSWER = 0
|
4
|
-
NO_USER_INPUT = %w[
|
4
|
+
NO_USER_INPUT = %w[
|
5
|
+
page.checkanswers
|
6
|
+
page.confirmation
|
7
|
+
page.content
|
8
|
+
page.start
|
9
|
+
].freeze
|
5
10
|
|
6
11
|
def self.map(view:, pages:, answers:)
|
7
12
|
user_input_pages(pages).map { |page|
|
8
|
-
Array(page.
|
13
|
+
Array(page.components_by_type(:input)).map do |component|
|
9
14
|
new(
|
10
15
|
view: view,
|
11
16
|
component: component,
|
@@ -47,11 +52,19 @@ module MetadataPresenter
|
|
47
52
|
end
|
48
53
|
|
49
54
|
def display_heading?(index)
|
50
|
-
|
55
|
+
multiplequestions_page? && index == FIRST_ANSWER
|
56
|
+
end
|
57
|
+
|
58
|
+
def last_multiple_question?(index, presenters_count_for_page)
|
59
|
+
multiplequestions_page? && index == presenters_count_for_page - 1
|
51
60
|
end
|
52
61
|
|
53
62
|
private
|
54
63
|
|
64
|
+
def multiplequestions_page?
|
65
|
+
page.type == 'page.multiplequestions'
|
66
|
+
end
|
67
|
+
|
55
68
|
def date(value)
|
56
69
|
I18n.l(
|
57
70
|
Date.civil(value.year.to_i, value.month.to_i, value.day.to_i),
|
@@ -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]">
|
@@ -51,6 +49,11 @@
|
|
51
49
|
<% end %>
|
52
50
|
</dd>
|
53
51
|
</div>
|
52
|
+
|
53
|
+
<% if page_answers_presenter.last_multiple_question?(index, page_answers_presenters.size) %>
|
54
|
+
</dl>
|
55
|
+
<dl class="fb-block fb-block-answers govuk-summary-list">
|
56
|
+
<% end %>
|
54
57
|
<% end %>
|
55
58
|
<% end %>
|
56
59
|
</dl>
|
@@ -1,19 +1,23 @@
|
|
1
1
|
Rails.application.config.page_components =
|
2
2
|
ActiveSupport::HashWithIndifferentAccess.new({
|
3
3
|
checkanswers: {
|
4
|
-
|
5
|
-
|
4
|
+
input: %w(),
|
5
|
+
content: %w(content)
|
6
6
|
},
|
7
7
|
confirmation: {
|
8
|
-
|
9
|
-
|
8
|
+
input: %w(),
|
9
|
+
content: %w(content)
|
10
10
|
},
|
11
11
|
content: {
|
12
|
-
|
13
|
-
|
12
|
+
input: %w(),
|
13
|
+
content: %w(content)
|
14
14
|
},
|
15
15
|
multiplequestions: {
|
16
|
-
|
17
|
-
|
18
|
-
}
|
16
|
+
input: %w(text textarea number date radios checkboxes),
|
17
|
+
content: %w(content)
|
18
|
+
},
|
19
|
+
singlequestion: {
|
20
|
+
input: %w(text textarea number date radios checkboxes),
|
21
|
+
content: %w()
|
22
|
+
}
|
19
23
|
})
|
@@ -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
@@ -280,6 +280,11 @@
|
|
280
280
|
"required": true
|
281
281
|
}
|
282
282
|
},
|
283
|
+
{
|
284
|
+
"_id": "star-wars-knowledge_content_1",
|
285
|
+
"_type": "content",
|
286
|
+
"content": "Stay on target"
|
287
|
+
},
|
283
288
|
{
|
284
289
|
"_id": "star-wars-knowledge_radios_1",
|
285
290
|
"_type": "radios",
|
@@ -340,12 +345,12 @@
|
|
340
345
|
"_id": "page._check-answers",
|
341
346
|
"_type": "page.checkanswers",
|
342
347
|
"heading": "Review your answer",
|
343
|
-
"section_heading": "This section is optional",
|
344
348
|
"send_body": "By submitting this answer you confirm all your answers",
|
345
349
|
"send_heading": "Send your answer",
|
346
350
|
"url": "/check-answers",
|
347
351
|
"components": [
|
348
352
|
{
|
353
|
+
"_uuid": "256291c2-8ffa-4bda-8282-88e0724ccd10",
|
349
354
|
"_id": "check-answers_content_1",
|
350
355
|
"_type": "content",
|
351
356
|
"content": "Check yourself before you wreck yourself."
|
@@ -353,6 +358,7 @@
|
|
353
358
|
],
|
354
359
|
"extra_components": [
|
355
360
|
{
|
361
|
+
"_uuid": "09961c6a-29f8-4d4f-a6d2-af00cff15536",
|
356
362
|
"_id": "check-answers_content_1",
|
357
363
|
"_type": "content",
|
358
364
|
"content": "Take the cannoli."
|
@@ -391,7 +397,7 @@
|
|
391
397
|
"_id": "page.accessibility",
|
392
398
|
"_type": "page.standalone",
|
393
399
|
"heading": "Accessibility Statement",
|
394
|
-
"body": "This accessibility statement applies to [describe your form here - for example, the general enquiries form for the CICA]. There is a separate [accessibility statement for the main GOV.UK website](https://www.gov.uk/help/accessibility-statement).\r\n\r\n###Using this online form\r\n\r\nThis form was built using a tool developed by the Ministry of Justice and uses components from the [GOV.UK Design System](https://design-system.service.gov.uk/).\r\n\r\n[insert your organisation here] is responsible for the content of this online form. The Ministry of Justice is responsible for its technical aspects.\r\n\r\nWe want as many people as possible to be able to use this online form. For example, that means you should be able to:\r\n\r\n- change colours, contrast levels and fonts\r\n- zoom in up to 300% without the text spilling off the screen\r\n- navigate the form using just a keyboard\r\n- navigate the form using speech recognition software\r\n- listen to the form using a screen reader (including recent versions of JAWS, NVDA and VoiceOver)\r\n\r\nWe’ve also made the text as simple as possible to understand.\r\n\r\n[AbilityNet](https://mcmw.abilitynet.org.uk/) has advice on making your device easier to use if you have a disability.\r\n\r\n###
|
400
|
+
"body": "This accessibility statement applies to [describe your form here - for example, the general enquiries form for the CICA]. There is a separate [accessibility statement for the main GOV.UK website](https://www.gov.uk/help/accessibility-statement).\r\n\r\n###Using this online form\r\n\r\nThis form was built using MoJ Forms, a tool developed by the Ministry of Justice, and uses components from the [GOV.UK Design System](https://design-system.service.gov.uk/).\r\n\r\n[insert your organisation here] is responsible for the content of this online form. The Ministry of Justice is responsible for its technical aspects.\r\n\r\nWe want as many people as possible to be able to use this online form. For example, that means you should be able to:\r\n\r\n- change colours, contrast levels and fonts\r\n- zoom in up to 300% without the text spilling off the screen\r\n- navigate the form using just a keyboard\r\n- navigate the form using speech recognition software\r\n- listen to the form using a screen reader (including recent versions of JAWS, NVDA and VoiceOver)\r\n\r\nWe’ve also made the text as simple as possible to understand.\r\n\r\n[AbilityNet](https://mcmw.abilitynet.org.uk/) has advice on making your device easier to use if you have a disability.\r\n\r\n###How accessible this form is\r\n\r\nWe know some parts of this form are not fully accessible:\r\n\r\n- pages have no skip links\r\n- the language attribute of the page has not been set in the HTML\r\n- some pages may contain empty headings\r\n- some content may be cut off or appear truncated when zooming in\r\n\r\n###Feedback and contact information\r\n\r\nIf you need information on this website in a different format:\r\n\r\n[insert your contact details for user requests here - add other channels, such as text phones or Relay UK, as required]\r\n\r\n- email: [your email address]\r\n- call: [your telephone number]\r\n- [Hours - e.g. Monday to Friday, 9am to 5pm]\r\n\r\n###Enforcement procedure\r\n\r\nThe Equality and Human Rights Commission (EHRC) is responsible for enforcing the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018 (the ‘accessibility regulations’). If you’re not happy with how we respond to your complaint, contact the [Equality Advisory and Support Service (EASS)](https://www.equalityadvisoryservice.com/).\r\n\r\n###Technical information about this online form’s accessibility\r\n\r\nWe are committed to making our online forms and services accessible, in accordance with the Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018.\r\n\r\n####Compliance status\r\n\r\nThis online form is partially compliant with the [Web Content Accessibility Guidelines version 2.1 AA standard](https://www.w3.org/TR/WCAG21/), due to the non-compliances listed below.\r\n\r\n###Non-accessible content\r\n\r\nThe content listed below is non-accessible for the following reasons.\r\n\r\n####Non compliance with the accessibility regulations\r\n\r\n1. Pages have no skip links. This issue may affect screen reader and keyboard users who use skip links to bypass repeated content such as headers and navigation menus to skip directly to the main page content.\r\n2. The language attribute of the page has not been set in the HTML. This may cause confusion to screen reader users who may not be able to identify the primary language of the page in their journey.\r\n3. Some pages may contain empty headings, including on the check answers page. As a result, screen reader users may have difficulty navigating these pages.\n4. Some content may be cut off or appear truncated when zooming in. This issue may affect low-vision users navigating the form who use reflow settings to view web pages.\r\n\r\nWe plan to fix these issues by July 2021.\r\n\r\n###Preparation of this accessibility statement\r\n\r\nThis statement was prepared on [date when it was first published]. It was last reviewed on [date when it was last reviewed].\r\n\r\nThis form was last tested on [date when you performed your basic accessibility check].\r\n\r\nIn order to test the compliance of all forms built using the MoJ Forms tool, the Ministry of Justice commissioned The Digital Accessibility Centre (DAC) to carry out a WCAG 2.1 AA level audit of a sample form. This included extensive testing by users with a wide range of disabilities. The audit was performed on 8 April 2021.\r\n\r\nIn addition, this form was tested by [insert team or organisation here]. It was tested using the [WAVE Web Accessibility Evaluation Tool](https://wave.webaim.org/) following guidance from the Ministry of Justice and Government Digital Service (GDS).\r\n\r\n###What we’re doing to improve accessibility\r\n\r\nWe will monitor the accessibility of this website on an ongoing basis and fix any accessibility issues reported to us.",
|
395
401
|
"components": [],
|
396
402
|
"url": "accessibility"
|
397
403
|
},
|
@@ -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.12
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_design_system_formbuilder
|