Sha256: 94132e4d909f743ee98682368a70ceaf92e65793879f25af26e54f9955d4b76e
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require_relative '../input' module CCS::Components module GovUK class Field < Base class Input < Field # = GOV.UK File Upload # # This is used for generating the file upload component from the # {https://design-system.service.gov.uk/components/file-upload GDS - Components - File Upload} class FileUpload < Input # @param (see CCS::Components::GovUK::Field::Input#initialize) # # @option (see CCS::Components::GovUK::Field::Input#initialize) def initialize(attribute:, **options) super(attribute: attribute, **options) end # Generates the HTML for the GOV.UK File Upload component # # @return [ActiveSupport::SafeBuffer] def render super() do if options[:form] options[:form].file_field(attribute, **options[:attributes]) else context.file_field_tag(attribute, **options[:attributes]) end end end # The default attributes for the file upload DEFAULT_ATTRIBUTES = { class: 'govuk-file-upload' }.freeze end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ccs-frontend_helpers-0.1.0.rc.2 | lib/ccs/components/govuk/field/input/file_upload.rb |