Sha256: 79f57ba50ecd021d27cbc7d28fc443f92b3d367274db3da004f1f4014455649c
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
module GOVUKDesignSystemFormBuilder module Elements class File < GOVUKDesignSystemFormBuilder::Base def initialize(builder, object_name, attribute_name, hint_text:, label:, **extra_args, &block) super(builder, object_name, attribute_name, &block) @label = label @hint_text = hint_text @extra_args = extra_args end def html Containers::FormGroup.new(@builder, @object_name, @attribute_name).html do safe_join( [ label_element.html, hint_element.html, error_element.html, supplemental_content.html, @builder.file_field( @attribute_name, id: field_id(link_errors: true), class: file_classes, aria: { describedby: described_by(hint_id, error_id, supplemental_id) }, **@extra_args ) ] ) end end private def file_classes %w(govuk-file-upload).tap do |c| c.push('govuk-file-upload--error') if has_errors? end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems