metadata_presenter 1.0.8 → 1.1.0

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: a9c2ec1af85d765a91dbf1e4558828cfa4e04698bc1a53c27753191644e14589
4
- data.tar.gz: cc258752398c51cde40f13cc94d0accc72f1fd0a2e7ef5e88a49dc54f847303b
3
+ metadata.gz: 2e5b66a42c87ed52b3d42de14186eda9c082acc168e22954ff890eef4ff18660
4
+ data.tar.gz: 7d996653714ee4d3c1fe36a0f27873bb0722f00e4f6686dc59200baf00a79bc4
5
5
  SHA512:
6
- metadata.gz: 61cafb1d8649b71d35ee3da5a9c6e404da5bed086628f3fa9e5b3c10dda963b6eb67d113e4a6a8bd60c6086d3e3ac06dfa4ad76e7236330513a1922faf8cdb7b
7
- data.tar.gz: e985eaf13f0729fa0f2a07a05d650e249435b03d1b13c1dfc2de961fbd385ecbcaafc2c8468e58748749f1a30f98c42b531d8285f99e2705cb46571a8933ae12
6
+ metadata.gz: 124a12434b079e4c404bf0e6fca476951257e3c7cd8f9d513150af64056de728645c3584b2b2aa88d0404600d3d5179caef71f1eceffc4141757683f6cb072d3
7
+ data.tar.gz: 0cc1262c395e0bd1a30e12566eea738a9030514990122b03dd57118079d3b9ed2e027016d99ca08ffd5db29b122862f919bf39a270544d77ba5b5e71f09801bd
@@ -5,6 +5,8 @@ module MetadataPresenter
5
5
  def create
6
6
  @page_answers = PageAnswers.new(page, answers_params)
7
7
 
8
+ upload_file if upload?
9
+
8
10
  if @page_answers.validate_answers
9
11
  save_user_data # method signature
10
12
  redirect_to_next_page
@@ -51,5 +53,13 @@ module MetadataPresenter
51
53
  def check_page_exists
52
54
  not_found if page.blank?
53
55
  end
56
+
57
+ def upload_file
58
+ super if defined?(super)
59
+ end
60
+
61
+ def upload?
62
+ Array(page.components).any?(&:upload?)
63
+ end
54
64
  end
55
65
  end
@@ -17,7 +17,7 @@ module MetadataPresenter
17
17
  # So in the Runner we defined the #create_submission in the parent
18
18
  # controller and in the Editor we don't.
19
19
  #
20
- if defined? super
20
+ if defined?(super)
21
21
  super
22
22
  end
23
23
  end
@@ -16,4 +16,8 @@ class MetadataPresenter::Component < MetadataPresenter::Metadata
16
16
  def content?
17
17
  type == 'content'
18
18
  end
19
+
20
+ def upload?
21
+ type == 'upload'
22
+ end
19
23
  end
@@ -34,6 +34,10 @@ class MetadataPresenter::Metadata
34
34
  value.blank? && editor? ? MetadataPresenter::DefaultText[method_name] : value
35
35
  end
36
36
 
37
+ def ==(other)
38
+ id == other.id if other.respond_to? :id
39
+ end
40
+
37
41
  def editor?
38
42
  @editor.present?
39
43
  end
@@ -14,10 +14,6 @@ module MetadataPresenter
14
14
  add_extra_component
15
15
  ].freeze
16
16
 
17
- def ==(other)
18
- id == other.id if other.respond_to? :id
19
- end
20
-
21
17
  def editable_attributes
22
18
  to_h.reject { |k, _| k.in?(NOT_EDITABLE) }
23
19
  end
@@ -58,6 +54,10 @@ module MetadataPresenter
58
54
  page_components(raw_type)[:content]
59
55
  end
60
56
 
57
+ def upload_components
58
+ components.select(&:upload?)
59
+ end
60
+
61
61
  private
62
62
 
63
63
  def to_components(node_components, collection:)
@@ -2,10 +2,12 @@ module MetadataPresenter
2
2
  class PageAnswers
3
3
  include ActiveModel::Model
4
4
  include ActiveModel::Validations
5
+ attr_reader :page, :answers, :uploaded_files
5
6
 
6
7
  def initialize(page, answers)
7
8
  @page = page
8
9
  @answers = answers
10
+ @uploaded_files = []
9
11
  end
10
12
 
11
13
  def validate_answers
@@ -23,11 +25,29 @@ module MetadataPresenter
23
25
 
24
26
  if component && component.type == 'date'
25
27
  date_answer(component.id)
28
+ elsif component && component.type == 'upload'
29
+ upload_answer(component.id)
26
30
  else
27
31
  answers[method_name.to_s]
28
32
  end
29
33
  end
30
34
 
35
+ def upload_answer(component_id)
36
+ file_details = answers[component_id.to_s]
37
+
38
+ return {} unless file_details
39
+
40
+ if file_details.is_a?(Hash) || file_details.is_a?(ActionController::Parameters)
41
+ file_details
42
+ else
43
+ {
44
+ 'original_filename' => file_details.original_filename,
45
+ 'content_type' => file_details.content_type,
46
+ 'tempfile' => file_details.tempfile.path.to_s
47
+ }
48
+ end
49
+ end
50
+
31
51
  def date_answer(component_id)
32
52
  date = raw_date_answer(component_id)
33
53
 
@@ -43,9 +63,5 @@ module MetadataPresenter
43
63
  answers["#{component_id}(#{segment})"]
44
64
  end
45
65
  end
46
-
47
- private
48
-
49
- attr_reader :page, :answers
50
66
  end
51
67
  end
@@ -79,5 +79,9 @@ module MetadataPresenter
79
79
  def checkboxes(value)
80
80
  value.join('<br>').html_safe
81
81
  end
82
+
83
+ def upload(file_hash)
84
+ file_hash['original_filename']
85
+ end
82
86
  end
83
87
  end
@@ -0,0 +1,7 @@
1
+ module MetadataPresenter
2
+ class AcceptValidator < UploadValidator
3
+ def error_name
4
+ 'accept'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ module MetadataPresenter
2
+ class MaxSizeValidator < UploadValidator
3
+ def error_name
4
+ 'invalid.too-large'
5
+ end
6
+
7
+ def error_message_hash
8
+ super.merge(
9
+ { schema_key.to_sym => human_max_size }
10
+ )
11
+ end
12
+
13
+ def human_max_size
14
+ (component.validation[schema_key] / (1024.0 * 1024.0)).round
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ module MetadataPresenter
2
+ class UploadValidator < BaseValidator
3
+ def invalid_answer?
4
+ user_answer.error_name == error_name
5
+ end
6
+
7
+ def user_answer
8
+ page_answers.uploaded_files.find do |uploaded_file|
9
+ component.id == uploaded_file.component.id
10
+ end
11
+ end
12
+
13
+ def error_message_hash
14
+ {
15
+ control: page_answers.send(component.id)['original_filename'],
16
+ schema_key.to_sym => component.validation[schema_key]
17
+ }
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ module MetadataPresenter
2
+ class VirusScanValidator < UploadValidator
3
+ def error_name
4
+ 'invalid.virus'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ <%= f.govuk_file_field component.id.to_sym,
2
+ label: { text: input_title },
3
+ hint: {
4
+ data: { "fb-default-text" => default_text('upload_hint') },
5
+ text: component.hint.present? ? component.hint : default_text('upload_hint')
6
+ },
7
+ accept: component.validation['accept'],
8
+ disabled: editable?
9
+ %>
@@ -17,7 +17,7 @@ Rails.application.config.page_components =
17
17
  content: %w(content)
18
18
  },
19
19
  singlequestion: {
20
- input: %w(text textarea number date radios checkboxes),
20
+ input: %w(text textarea number date radios checkboxes upload),
21
21
  content: %w()
22
22
  }
23
23
  })
@@ -0,0 +1,13 @@
1
+ {
2
+ "_id": "component.upload",
3
+ "_type": "upload",
4
+ "errors": {},
5
+ "label": "Question",
6
+ "hint": "Maximum file size is 7MB",
7
+ "name": "component-name",
8
+ "validation": {
9
+ "required": true,
10
+ "max_size": "7340032",
11
+ "virus_scan": true
12
+ }
13
+ }
@@ -2,7 +2,7 @@
2
2
  "_id": "page.singlequestion",
3
3
  "_type": "page.singlequestion",
4
4
  "section_heading": "",
5
- "heading": "Question",
5
+ "heading": "",
6
6
  "lede": "",
7
7
  "body": "Body section",
8
8
  "components": [],
@@ -0,0 +1,6 @@
1
+ {
2
+ "_id": "error.accept",
3
+ "_type": "string.error",
4
+ "description": "File uploaded is wrong type",
5
+ "value": "%{control} was not uploaded successfully as it is the wrong type"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "_id": "error.max_size",
3
+ "_type": "string.error",
4
+ "description": "File is too large",
5
+ "value": "The selected file must be smaller than %{max_size}MB."
6
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "_id": "error.virus_scan",
3
+ "_type": "string.error",
4
+ "description": "File uploaded contains virus",
5
+ "value": "%{control} was not uploaded successfully because it contains a virus"
6
+ }
7
+
@@ -5,5 +5,6 @@
5
5
  "content": "[Optional content]",
6
6
  "hint": "[Optional hint text]",
7
7
  "option": "Option",
8
- "option_hint": "[Optional hint text]"
8
+ "option_hint": "[Optional hint text]",
9
+ "upload_hint": "Maximum file size is 7MB"
9
10
  }
@@ -20,6 +20,7 @@
20
20
  "page.burgers",
21
21
  "page.star-wars-knowledge",
22
22
  "page.how-many-lights",
23
+ "page.dog-picture",
23
24
  "page.check-answers",
24
25
  "page.confirmation"
25
26
  ],
@@ -432,6 +433,71 @@
432
433
  "add_component": "content",
433
434
  "section_heading": "Chain of Command"
434
435
  },
436
+ {
437
+ "_id": "page.dog-picture",
438
+ "url": "dog-picture",
439
+ "_type": "page.singlequestion",
440
+ "_uuid": "2ef7d11e-0307-49e9-9fe2-345dc528dd66",
441
+ "heading": "Question",
442
+ "components": [
443
+ {
444
+ "_id": "dog-picture_upload_1",
445
+ "name": "dog-picture_upload_1",
446
+ "_type": "upload",
447
+ "_uuid": "f056a76e-ec3f-47ae-b625-1bba92220ad1",
448
+ "hint": "",
449
+ "legend": "Upload your best dog photo",
450
+ "max_files": 1,
451
+ "validation": {
452
+ "required": true,
453
+ "accept": [
454
+ "audio/*",
455
+ "image/bmp",
456
+ "text/csv",
457
+ "application/vnd.ms-excel",
458
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
459
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
460
+ "application/vnd.ms-excel.sheet.macroEnabled.12",
461
+ "application/vnd.ms-excel.template.macroEnabled.12",
462
+ "application/vnd.ms-excel.addin.macroEnabled.12",
463
+ "application/vnd.ms-excel.sheet.binary.macroEnabled.12",
464
+ "image/gif",
465
+ "image/*",
466
+ "application/x-iwork-pages-sffpages",
467
+ "image/jpeg",
468
+ "application/pdf",
469
+ "text/plain",
470
+ "image/png",
471
+ "application/vnd.ms-powerpoint",
472
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
473
+ "application/vnd.openxmlformats-officedocument.presentationml.template",
474
+ "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
475
+ "application/vnd.ms-powerpoint.addin.macroEnabled.12",
476
+ "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
477
+ "application/vnd.ms-powerpoint.template.macroEnabled.12",
478
+ "application/vnd.ms-powerpoint.slideshow.macroEnabled.12",
479
+ "text/rtf",
480
+ "excel",
481
+ "csv",
482
+ "image/svg+xml",
483
+ "pdf",
484
+ "word",
485
+ "rtf",
486
+ "plaintext",
487
+ "image/tiff",
488
+ "video/*",
489
+ "application/msword",
490
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
491
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
492
+ "application/vnd.ms-word.document.macroEnabled.12",
493
+ "application/vnd.ms-word.template.macroEnabled.12"
494
+ ],
495
+ "max_size": 7340032,
496
+ "virus_scan": true
497
+ }
498
+ }
499
+ ]
500
+ },
435
501
  {
436
502
  "_id": "page.check-answers",
437
503
  "url": "check-answers",
@@ -532,7 +598,7 @@
532
598
  {
533
599
  "_id": "page.accessibility",
534
600
  "url": "accessibility",
535
- "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.",
601
+ "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###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\nWe'll consider your request and get back to you in [add your SLA - e.g. a week or 5 working days].\r\n\r\n###Reporting accessibility problems with this form\r\n\r\nWe’re always looking to improve the accessibility of this form. If you find any problems not listed on this page or think we’re not meeting accessibility requirements, contact:\r\n\r\n[insert your contact details for user feedback 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 fully compliant with the [Web Content Accessibility Guidelines version 2.1 AA standard](https://www.w3.org/TR/WCAG21/)\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. The audit highlighted a number of non-compliance issues which were fixed on 11 May 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 the 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.",
536
602
  "_type": "page.standalone",
537
603
  "_uuid": "c439c7fd-f411-4e11-8598-4023934bac93",
538
604
  "heading": "Accessibility statement",
@@ -1,3 +1,3 @@
1
1
  module MetadataPresenter
2
- VERSION = '1.0.8'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
@@ -0,0 +1,40 @@
1
+ {
2
+ "$id": "http://gov.uk/schema/v1.0.0/upload",
3
+ "_name": "component.upload",
4
+ "title": "Upload",
5
+ "description": "Let users select and upload one or more files",
6
+ "type": "object",
7
+ "properties": {
8
+ "_type": {
9
+ "const": "upload"
10
+ },
11
+ "max_files": {
12
+ "title": "Maximum number of files",
13
+ "description": "Maximum number of files a user can upload",
14
+ "type": "number",
15
+ "default": 1
16
+ },
17
+ "min_files": {
18
+ "title": "Minimum number of files",
19
+ "description": "Minimum number of files a user can upload - 1 if required, 0 if not required",
20
+ "type": "number"
21
+ }
22
+ },
23
+ "allOf": [
24
+ {
25
+ "$ref": "definition.field"
26
+ },
27
+ {
28
+ "$ref": "definition.width_class.input"
29
+ },
30
+ {
31
+ "$ref": "validations#/definitions/errors_accept"
32
+ },
33
+ {
34
+ "$ref": "validations#/definitions/errors_max_size"
35
+ },
36
+ {
37
+ "$ref": "validations#/definitions/errors_virus_scan"
38
+ }
39
+ ]
40
+ }
@@ -58,6 +58,14 @@
58
58
  }
59
59
  ]
60
60
  },
61
+ "errors_virus_scan": {
62
+ "title": "Error messages for 'Virus Scan'",
63
+ "allOf": [
64
+ {
65
+ "$ref": "#/definitions/error_strings"
66
+ }
67
+ ]
68
+ },
61
69
  "min_length": {
62
70
  "title": "Minimum length",
63
71
  "description": "The minimum characters users must enter",
@@ -270,6 +278,66 @@
270
278
  }
271
279
  ]
272
280
  },
281
+ "accept": {
282
+ "title": "Accepted types",
283
+ "description": "Which file types to accept",
284
+ "type": "array",
285
+ "items": {
286
+ "type": "string",
287
+ "enum": [
288
+ "audio/*",
289
+ "image/bmp",
290
+ "text/csv",
291
+ "application/vnd.ms-excel",
292
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
293
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
294
+ "application/vnd.ms-excel.sheet.macroEnabled.12",
295
+ "application/vnd.ms-excel.template.macroEnabled.12",
296
+ "application/vnd.ms-excel.addin.macroEnabled.12",
297
+ "application/vnd.ms-excel.sheet.binary.macroEnabled.12",
298
+ "image/gif",
299
+ "image/*",
300
+ "application/x-iwork-pages-sffpages",
301
+ "image/jpeg",
302
+ "applicattion/pdf",
303
+ "text/plain",
304
+ "image/png",
305
+ "application/vnd.ms-powerpoint",
306
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
307
+ "application/vnd.openxmlformats-officedocument.presentationml.template",
308
+ "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
309
+ "application/vnd.ms-powerpoint.addin.macroEnabled.12",
310
+ "application/vnd.ms-powerpoint.presentation.macroEnabled.12",
311
+ "application/vnd.ms-powerpoint.template.macroEnabled.12",
312
+ "application/vnd.ms-powerpoint.slideshow.macroEnabled.12",
313
+ "text/rtf",
314
+ "excel",
315
+ "csv",
316
+ "image/svg+xml",
317
+ "pdf",
318
+ "word",
319
+ "rtf",
320
+ "plaintext",
321
+ "image/tiff",
322
+ "video/*",
323
+ "application/msword",
324
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
325
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
326
+ "application/vnd.ms-word.document.macroEnabled.12",
327
+ "application/vnd.ms-word.template.macroEnabled.12"
328
+ ]
329
+ }
330
+ },
331
+ "max_size": {
332
+ "title": "Maximum size",
333
+ "description": "Maximum file size as human readable string or bytes",
334
+ "type": "string"
335
+ },
336
+ "virus_scan": {
337
+ "title": "Virus scan",
338
+ "description": "Scanning of files for viruses",
339
+ "type": "boolean"
340
+ },
273
341
  "required_bundle": {
274
342
  "properties": {
275
343
  "validation": {
@@ -294,43 +362,6 @@
294
362
  }
295
363
  }
296
364
  },
297
- "upload_bundle": {
298
- "properties": {
299
- "validation": {
300
- "title": "Validation",
301
- "description": "Values for default validation",
302
- "role": "validation",
303
- "properties": {
304
- "accept": {
305
- "title": "Accepted types",
306
- "description": "Which file types to accept",
307
- "type": "array",
308
- "items": {
309
- "type": "string"
310
- }
311
- },
312
- "max_size": {
313
- "title": "Maximum size",
314
- "description": "Maximum file size as human readable string or bytes",
315
- "type": "string"
316
- }
317
- }
318
- },
319
- "errors": {
320
- "title": "Errors",
321
- "description": "Strings to override for default error messages",
322
- "role": "error_strings",
323
- "properties": {
324
- "accept": {
325
- "$ref": "#/definitions/errors_accept"
326
- },
327
- "maxSize": {
328
- "$ref": "#/definitions/errors_max_size"
329
- }
330
- }
331
- }
332
- }
333
- },
334
365
  "string_bundle": {
335
366
  "properties": {
336
367
  "validation": {
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: 1.0.8
4
+ version: 1.1.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-05-06 00:00:00.000000000 Z
11
+ date: 2021-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_design_system_formbuilder
@@ -272,14 +272,18 @@ files:
272
272
  - app/models/metadata_presenter/page_answers.rb
273
273
  - app/models/metadata_presenter/service.rb
274
274
  - app/presenters/metadata_presenter/page_answers_presenter.rb
275
+ - app/validators/metadata_presenter/accept_validator.rb
275
276
  - app/validators/metadata_presenter/base_validator.rb
276
277
  - app/validators/metadata_presenter/date_validator.rb
277
278
  - app/validators/metadata_presenter/max_length_validator.rb
279
+ - app/validators/metadata_presenter/max_size_validator.rb
278
280
  - app/validators/metadata_presenter/min_length_validator.rb
279
281
  - app/validators/metadata_presenter/number_validator.rb
280
282
  - app/validators/metadata_presenter/required_validator.rb
283
+ - app/validators/metadata_presenter/upload_validator.rb
281
284
  - app/validators/metadata_presenter/validate_answers.rb
282
285
  - app/validators/metadata_presenter/validate_schema.rb
286
+ - app/validators/metadata_presenter/virus_scan_validator.rb
283
287
  - app/views/errors/404.html
284
288
  - app/views/layouts/metadata_presenter/application.html.erb
285
289
  - app/views/metadata_presenter/attribute/_body.html.erb
@@ -294,6 +298,7 @@ files:
294
298
  - app/views/metadata_presenter/component/_radios.html.erb
295
299
  - app/views/metadata_presenter/component/_text.html.erb
296
300
  - app/views/metadata_presenter/component/_textarea.html.erb
301
+ - app/views/metadata_presenter/component/_upload.html.erb
297
302
  - app/views/metadata_presenter/footer/_meta.html.erb
298
303
  - app/views/metadata_presenter/footer/footer.html.erb
299
304
  - app/views/metadata_presenter/header/show.html.erb
@@ -317,6 +322,7 @@ files:
317
322
  - default_metadata/component/radios.json
318
323
  - default_metadata/component/text.json
319
324
  - default_metadata/component/textarea.json
325
+ - default_metadata/component/upload.json
320
326
  - default_metadata/config/meta.json
321
327
  - default_metadata/config/service.json
322
328
  - default_metadata/definition/checkbox.json
@@ -329,11 +335,14 @@ files:
329
335
  - default_metadata/page/standalone.json
330
336
  - default_metadata/page/start.json
331
337
  - default_metadata/service/base.json
338
+ - default_metadata/string/error.accept.json
332
339
  - default_metadata/string/error.date.json
333
340
  - default_metadata/string/error.max_length.json
341
+ - default_metadata/string/error.max_size.json
334
342
  - default_metadata/string/error.min_length.json
335
343
  - default_metadata/string/error.number.json
336
344
  - default_metadata/string/error.required.json
345
+ - default_metadata/string/error.virus_scan.json
337
346
  - default_text/content.json
338
347
  - fixtures/invalid_content_page.json
339
348
  - fixtures/no_component_page.json
@@ -352,6 +361,7 @@ files:
352
361
  - schemas/component/radios.json
353
362
  - schemas/component/text.json
354
363
  - schemas/component/textarea.json
364
+ - schemas/component/upload.json
355
365
  - schemas/condition/condition.json
356
366
  - schemas/config/meta.json
357
367
  - schemas/config/service.json